提交时间:2023-09-11 14:38:22

运行 ID: 101953

#include <iostream> #include <algorithm> using namespace std; typedef long long LL; string s, t, ans[105]; int n; int main() { getline(cin, s); for (int i = 0; i < s.size(); i++) if (isalpha(s[i])) t += s[i]; else { ans[++n] = t; t = ""; } sort(ans + 1, ans + n + 1); cout << n << endl; for (int i = 1; i <= n; i++) cout << ans[i] << endl; return 0; }