C++ binarysearch and stuff 🥇🥇🥇
1) map every character to the indexes it appears in s\n2) iterate thru all the words and check for the next character with binarysearch\n3) logon to twitch and 
1) map every character to the indexes it appears in s\n2) iterate thru all the words and check for the next character with binarysearch\n3) logon to twitch and check me solving this LIVE ON STREAM.  link in profile\n\n```\nclass Solution {\npublic:\n    int numMatchingSubseq(string s, vector<string>& words) {\n        vector<vector<int>> charMap(26);\n        int n = s.length();\n        \n        for(int i = 0; i < n; i++) {\n            charMap[s[i] - \'a\'].push_back(i);\n        }\n        \n        int ans = words.size();\n        \n        for(auto& word : words) {\n            int last = -1;\n            \n            for(char c : word) {\n                auto& cIndexes = charMap[c - \'a\'];\n                auto it = upper_bound(cIndexes.begin(), cIndexes.end(), last);\n                if(it == cIndexes.end()) {\n                    ans--;\n                    break;\n                } else {\n                    last = *it;\n                }\n            }\n        }\n        \n        return ans;\n    }\n};\n```
[]