very simple solution
Code
# Code
```cpp []
class Solution {
public:
    int prefixCount(vector<string>& words, string pref) {
        int  ans=0;
        for(auto &x:words){
         if(x.size()<pref.size()) continue;
         if(x[0]!=pref[0]) continue;
         if(x.substr(0,pref.size())==pref) ans++;
        }
        return ans;
    }
};
```
['C++']