提交时间:2023-08-22 21:14:39
运行 ID: 99485
#include<string> #include<vector> #include<sstream> #include<iostream> #include<algorithm> using namespace std; int main() { vector<string>v; string s, t; stringstream r; getline(cin, s); for (int i{}; i < s.size(); i++) { if (s[i] == '!' || s[i] == '.') break; if (s[i] == ',') s[i] = ' '; t += s[i]; } r << t; while (r >> s) v.push_back(s); sort(begin(v), end(v)); cout << v.size() << endl; for (auto x : v) cout << x << endl; return 0; }