[Java Using Hashset. Simple code O(w*s) Time
\npublic int countConsistentStrings(String allowed, String[] words) {\n\tint consistent = 0;\n\tSet<Character> allowedLetters = new HashSet<>(); // added Set to
```\npublic int countConsistentStrings(String allowed, String[] words) {\n\tint consistent = 0;\n\tSet<Character> allowedLetters = new HashSet<>(); // added Set to search in O(1)\n\n\tfor(char letter : allowed.toCharArray())\n\t{\n\t\tallowedLetters.add(letter);\n\t}\n\n\tfor(String word : words)\n\t{\n\t\tfor(int i = 0; i < word.length(); i++)\n\t\t{\n\t\t\tif(!allowedLetters.contains(word.charAt(i)))\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(i == word.length() -1)\n\t\t\t{\n\t\t\t\tconsistent++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn consistent;\n}\n```
['Java']