AC了 int main() { string temp,s,x; cin>>s>>x; vector<string> v; int pos = s.find(x, 0); int old = pos; v.push_back(s.substr(0, old)); while (pos != string::npos) { old = pos; pos = s.find(x, pos + x.size()); v.push_back(s.substr(old + x.size(), pos - old - x.size())); } for (auto c : v) cout << c << endl; return 0; }
点赞 1

相关推荐

牛客网
牛客企业服务