c++ boost string get number of time repeat character code example Example: count a character in a string c++ count(str.begin(), str.end(), 'e')