C++ bitset in single processor register
We capture the set of allowable characters into a set of flags that will fit in a single processor register and allow constant time lookup when we traverse the 
We capture the set of allowable characters into a set of flags that will fit in a single processor register and allow constant time lookup when we traverse the words later:\n\n```cpp\n        uint32_t a = 0;\n        for(auto c: allowed)\n        {\n            a |= 1u << (c - \'a\');\n        }\n```\n\nWe can then test a word against that bitset very cheaply by iterating over its letters like this:\n```cpp\nbool consistent(const string& s, const uint32_t a)\n{\n        for(auto c: s)\n        {\n            if((a & (1u << (c - \'a\'))) == 0) return false;\n        }      \n        return true;\n}\n```\n\nAnd we can achieve our final result by iterating over all our words, pumping each one through this function:\n```cpp\n        size_t count = 0;\n        for(auto& w : words){\n            count += consistent(w, a);\n        }\n        \n        return count;\n```\n\n\n\n\n\n\n\n\n![image](https://assets.leetcode.com/users/images/8a5b0015-c5f1-402a-9751-fbf3f9a1549e_1614337111.8972156.png)\n\n\n\n\n\n\n## Full Code  Listing\n\n```cpp\n\n\nbool consistent(const string& s, const uint32_t a)\n{\n        for(auto c: s)\n        {\n            if((a & (1u << (c - \'a\'))) == 0) return false;\n        }\n        \n        return true;\n}\n\nclass Solution {\npublic:\n    __attribute__((optimize(3)))\n    static int countConsistentStrings(const string& allowed, const vector<string>& words) {\n        uint32_t a = 0;\n        for(auto c: allowed)\n        {\n            a |= 1u << (c - \'a\');\n        }\n        \n        size_t count = 0;\n        for(auto& w : words){\n            count += consistent(w, a);\n        }\n        \n        return count;\n        \n    }\n};\n\nstatic const auto fast=[](){ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);return nullptr;}();\n\n\n```
['C', 'C++']