Solution By Dare2Solve | Detailed Explanation | Clean Code
Explanation []\nauthorslog.com/blog/ob8tSXjthN\n\n# Code\n\ncpp []\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& wo
```Explanation []\nauthorslog.com/blog/ob8tSXjthN\n```\n# Code\n\n```cpp []\nclass Solution {\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) {\n        unordered_set<char> allowedSet(allowed.begin(), allowed.end());\n        int count = 0;\n\n        for (const string& word : words) {\n            bool consistent = true;\n            for (char c : word) {\n                if (allowedSet.find(c) == allowedSet.end()) {\n                    consistent = false;\n                    break;\n                }\n            }\n            if (consistent) count++;\n        }\n\n        return count;\n    }\n};\n```\n\n```python []\nclass Solution:\n    def countConsistentStrings(self, allowed: str, words: List[str]) -> int:\n        allowed_set = set(allowed)\n        count = 0\n\n        for word in words:\n            if all(c in allowed_set for c in word):\n                count += 1\n\n        return count\n```\n\n```java []\nclass Solution {\n    public int countConsistentStrings(String allowed, String[] words) {\n        Set<Character> allowedSet = new HashSet<>();\n        for (char c : allowed.toCharArray()) {\n            allowedSet.add(c);\n        }\n\n        int count = 0;\n        for (String word : words) {\n            boolean consistent = true;\n            for (char c : word.toCharArray()) {\n                if (!allowedSet.contains(c)) {\n                    consistent = false;\n                    break;\n                }\n            }\n            if (consistent) count++;\n        }\n\n        return count;\n    }\n}\n```\n\n```javascript []\nvar countConsistentStrings = function (allowed, words) {\n    let count = 0;\n    for (let i = 0; i < words.length; i++) {\n        const arr = [...new Set([...Array.from(words[i])])]\n        if (!arr.some(el => !allowed.includes(el))) count++;\n    };\n    return count;\n};\n```
['Hash Table', 'Python', 'C++', 'Java', 'Python3', 'JavaScript']