提交时间:2023-08-22 14:10:01
运行 ID: 99218
#include <bits/stdc++.h> using namespace std; string a[105]; string s; int cnt=0; signed main() { getline(cin,s); string tmp = ""; for(int i = 0; i < s.length(); i++) { if(s[i]==',' || s[i]==' ' || s[i]=='.' || s[i]=='!') { a[++cnt]=tmp; tmp = ""; } else { tmp += s[i]; } } sort(a+1,a+cnt+1); cout << cnt << endl; for(int i = 1; i <= cnt; i++) { cout << a[i] << endl; } return 0; }