2019-05-11 Count a substring in a string cin >> s; found = s.find("AB"); while(found != string::npos){ cnt++; found = s.find("AB", found+1); }