C++ Solution Using Hashing and Binary Search
\nclass Solution {\npublic:\n    int numMatchingSubseq(const std::string& str,std::vector<std::string> &words) {\n        std::vector<std::vector<int>> m(26);\n
```\nclass Solution {\npublic:\n    int numMatchingSubseq(const std::string& str,std::vector<std::string> &words) {\n        std::vector<std::vector<int>> m(26);\n\n      for(int i=0;i<str.length();i++)\n        m[str.at(i)-\'a\'].push_back(i);\n\n      int count=0;\n\n      for(int i=0; i < words.size(); i++){\n        bool found{true};\n\n        int x=-1;\n        for(int j=0; j<words[i].length();++j){\n          int idx=words[i].at(j)-\'a\';\n\n          auto it = upper_bound(m[idx].begin(), m[idx].end(), x);\n          if(it==m[idx].end()) {\n            found=false;\n            break;\n          }\n          x=*it;\n        }\n        if(found) \n          count++;\n      }\n      return count;\n    }\n};\n```
['Binary Search', 'C']