Simple Using Substr | C++
Please Upvote If you Like the Solution !!!\n# Code\n\nclass Solution {\npublic:\n    int countPrefixes(vector<string>& words, string s) {\n        int ans = 0;\
`Please Upvote If you Like the Solution !!!`\n# Code\n```\nclass Solution {\npublic:\n    int countPrefixes(vector<string>& words, string s) {\n        int ans = 0;\n        for(auto &w : words) {\n            int n = w.size();\n            if(s.substr(0,n) == w) ans++;\n        }\n        return ans;\n    }\n};\n```
['C++']