Java Bit Manipulation %99 faster (𝐖𝐢𝐭𝐡 𝐄𝐱𝐩𝐥𝐚𝐧𝐚𝐭𝐢𝐨𝐧)
Code:\n\nclass Solution {\n    public int countConsistentStrings(String allowed, String[] words) {\n        int count = words.length;\n        int bitset = 0;\n
### Code:\n```\nclass Solution {\n    public int countConsistentStrings(String allowed, String[] words) {\n        int count = words.length;\n        int bitset = 0;\n        for (char c : allowed.toCharArray()) {\n            bitset |= 1 << c - \'a\';\n        }\n\n        for (String word : words) {\n            for (char c : word.toCharArray()) {\n                if ((bitset & (1 << c - \'a\')) == 0) {\n                    count--;\n                    break;\n                }\n            }\n        }\n        return count;        \n    }\n}\n```\n\n### Solution:\n\n```\n\tInput: allowed = "ab", words = ["ad","bd","aaab","baa","badab"]\n\t\n\t\n(1) : First Iteration Datas\n\n    allow: "ab",  words[0] = "ad"\n    \n\t\n(2) : Convert "ab" to bitset \n\n     (bitset |= 1 << c - \'a\')   \n\t  bitset = 1 << 0;    \n\t  bitset = 1 << 1;\n\t\t  \n     bitset:\n    .. h g f e d c b a\n    .. 0 0 0 0 0 0 1 1\n    \n(3):  Prepare chars of word ("ad") like \'a\' and \'d\'\n\n    word[0]  char \'a\':\n    .. h g f e d c b a\n    .. 0 0 0 0 0 0 0 1\n    \n    word[0]  char \'d\':\n    .. h g f e d c b a\n    .. 0 0 0 1 0 0 0 0\n\t\n(4) : Compare bitset and chars of word[0]\n\t\n    bitset & char \'a\':   ( "ab" & \'a\')\n        .. 0 0 0 0 0 0 1 1\n     &  .. 0 0 0 0 0 0 0 1\n     \u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\n           0 0 0 0 0 0 0 1   : true <==\n    \n  \n    bitset & char \'d\' :   ( "ab" &  \'d\')\n        .. 0 0 0 0 0 0 1 1\n     &  .. 0 0 0 0 1 0 0 0\n     \u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\u203E\n           0 0 0 0 0 0 0 0   : false <== \n\t\t   \n\tcount --;\t   \n```\n\n
['Bit Manipulation', 'Java']