class Solution {
public:
bool check(string str,string pattern) {
int ls = str.length(),lp = pattern.length();
if (ls < lp) return false;
else {
for (int i = 0; i < lp; i++) {
if (str[i] != pattern[i]) {
return false;
}
}
return true;
}
}
int prefixCount(vector<string>& words, string pref) {
int cnt = 0;
for (auto s : words) {
if (check(s,pref)) {
cnt += 1;
}
}
return cnt;
}
};