C++ online with std::count_if and string::rfind
This stackover flow post descrives how to you string::rfind to implement startsWith, which leads to following over all code to solve to problem.\n\n\nint countP
This [stackover flow post](https://stackoverflow.com/questions/1878001/how-do-i-check-if-a-c-stdstring-starts-with-a-certain-string-and-convert-a) descrives how to you ```string::rfind``` to implement ```startsWith```, which leads to following over all code to solve to problem.\n\n```\nint countPrefixes(const vector<string>& ws, const string& s) {\n    return count_if(begin(ws), end(ws), [&](const string& w) { return s.rfind(w, 0) == 0; });\n}\n```\n\nOne might was well could use ```string::compare``` to solve the problem as well:\n\n```\nint countPrefixes(const vector<string>& ws, const string& s) {\n    return count_if(begin(ws), end(ws), [&](const string& w) {\n        return s.compare(0, size(w), w) == 0;\n    });\n}\n```
['C']