将字符串转换为流进行操作
#include<bits/stdc++.h>
using namespace std;
int main() {
vector<string> ves;
string str = "The early bird catches the worm .";
string s;
istringstream ss(str);
while (ss >> s) {
ves.push_back(s);
}
for (auto ve: ves) {
cout << ve << " ";
}
return 0;
}