C++ Solution
\nclass Solution {\npublic:\n    int prefixCount(vector<string>& words, string pref) {\n        int ans  = 0;\n            for(int i = 0; i < words.size(); i++)
```\nclass Solution {\npublic:\n    int prefixCount(vector<string>& words, string pref) {\n        int ans  = 0;\n            for(int i = 0; i < words.size(); i++){\n                    int j = 0;\n                    int n = words[i].length();\n                    if(n<pref.length())continue;\n                    {\n        while(j<pref.length()){\n        if(pref[j] == words[i][j])\n               j++;\n                    }\n                      else \n                          break;            \n                    }\n                    if(j==pref.length())ans++;\n            }\n            return ans;\n    }\n};\n```
[]