string str; getline(cin , str);
istringstream sin(str);
vector<string> words; //不重复单词 set<string> words;
string word;
while(sin >> word) words.push_back(word); //words.insert(word);
int re = words.size(); //单词个数
单词分割模板
最新推荐文章于 2024-09-14 22:25:23 发布