1.多次寻找并且不回溯
string s; int pos = 0; int n = s.size(); while(pos < n) { pos = s.find("Alice",pos); //从pos位置开始寻找Alice if(pos == -1) break; pos++; } 2.只找第一个位置 int pos = s.find("Alice",0); if(pos == -1) cout << "没找到";