Posted on

Description

Submission

class Solution {
public:
    int countConsistentStrings(string allowed, vector<string>& words) {
        unordered_set<char> Set;
        for(char c: allowed) {
            Set.insert(c);
        }

        int ret = words.size();
        for(auto& word: words) {
            for(auto c: word) { 
                if(Set.find(c) == Set.end()) {
                    ret--;
                    break;
                }
            }
        }

        return ret;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *