How can I count the number of "_" in a string like "bla_bla_blabla_bla"?
"_"
"bla_bla_blabla_bla"
#include <algorithm> std::string s = "a_b_c"; size_t n = std::count(s.begin(), s.end(), '_');
1.4m articles
1.4m replys
5 comments
56.9k users