Bit manipulation with EXPLANATION
\n# Approach\nInstead of using map to store the characters of the string allowed we can do it in just a single integer variable.\n- int map = 0\n\n  An integer 
\n# Approach\nInstead of using map to store the characters of the string ``` allowed ``` we can do it in just a single integer variable.\n- ``` int map = 0 ```\n```\n  An integer can store 32 bits. A 26 bit binary representation given below  \n\n  1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1\n  | | | | | | | | | | | | | | | | | | | | | | | | | |\n  z y x w v u t s r q p o n m l k j i h g f e d c b a\n  \n  Soppose each bit representing its denoted character, if the bit is 1\n  it means its denoted character exists, otherwise not. \n  Ex : The last bit is 1, means a exist here, but b doesn\'t as it\'s bit 0 \n```\n- Suppose string ``` allowed = "dap" ```\n```\nAs int map = 0, 26 bits of map = 0 is\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n\nallowed[0] = \'d\', so for \'d\' new map = \n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 0\n                                             |\n                                             representing \'d\'\n\nallowed[1] = \'a\', so for \'a\' new map = \n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 \'1\'\n                                              _____|\n                                             |\n                                             representing \'a\'\n\nallowed[2] = \'p\', so for \'p\' new map = \n0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1\n                     |\n                     representing \'p\'\n```\n- That means we need to ``` left shift 1 by (allowed[i]-\'a\') times ``` and then perform or ```|``` bitwise operation with ``` map ``` till the last character of the string ``` allowed ```.\n```\nallowed[0] = \'d\', so left shift 1 by \'d\'-\'a\' = 3 times and do |\n\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0  0  0 0 0\n                                          |  1\n_____________________________________________________\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 0 (new map)\n\nallowed[1] = \'a\', so left shift 1 by \'a\'-\'a\' = 0 times and do |\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0  0\n                                                  |  1\n________________________________________________________\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 \'1\' (new map)\n\nallowed[2] = \'p\', so left shift 1 by \'p\'-\'a\' = 15 times and do |\n0 0 0 0 0 0 0 0 0 0  0  0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 \'1\'\n                   | 1                           \n_________________________________________________________\n0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 0 0 0 0 0 0 0 0 0 \'1\' 0 0 \'1\' (new map)\n\nFinally the map  =   1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 = 32778 in decimal\n```\n - To check a character exists in map ``` left shift 1 by (\'character\' - \'a\') times ``` and then perform bitwise and ```&``` operation with ``` map ``` everytime just like we did to check a number is even or odd.\n### \n - Time complexity : O(N^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity : O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n#### Any Q will be appreciated. If the post was helpful plz upvote.\n```\nclass Solution \n{\npublic:\n    int countConsistentStrings(string allowed, vector<string>& words) \n    {\n        int map=0, count = 0, consistent;\n        for(char c:allowed)\n        {\n            map = map | (1<<c-\'a\');\n        }\n        for(string &s:words)\n        {\n            consistent = 1;\n            for(char &c:s)\n            {\n                if((map & (1<<c-\'a\')) == 0)\n                {\n                    consistent = 0;\n                    break;\n                }\n            }\n            count += consistent;\n        }\n        return count;\n    }\n};\n```
['C++']