1 2 3 4 5 6 7 8 9
#include <algorithm> int main() { const std::string str = "abfaabsd"; std::cout << std::count(str.begin(), str.end(), 'a') << std::endl; return 0; }
1
3