K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
#include <iostream> #include <string> using namespace std; int main() { string s = "hello world"; s.append(3, '!'); int pos = s.find('w'); string sub = s.substr(pos, 5); cout << sub.size() << " " << sub << endl; return 0; }
5 world
5 world!!!
3 world
8 world!!!