#include #include using namespace std; int main() { // 1 2 //01234567890123456789012 string phrase = "Danger, Danger, Danger!"; string search = ","; size_t pos{0}; int count{0}; pos = phrase.find(search); while (pos != string::npos) { count ++; pos = phrase.find(search,pos+1); } cout << search << " occured " << count << " times in " << phrase << "." << endl; return 0; }