how to find the number of characters in a string cpp code example Example: count a character in a string c++ count(str.begin(), str.end(), 'e')