这里不需要输入一整行,一个一个的输入就可以,然后就是用了string里面的stringstream,时间也没有太多要求,还是好写的
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
int main() {
string line;
set<string> st;
while (cin >> line) {
for (int i = 0; i < sz(line); i++) {
if (!isalpha(line[i])) line[i] = ' ';
else line[i] = tolower(line[i]);
}
stringstream ss(line);
string s;
while (ss >> s) st.insert(s);
}
for (set<string>::iterator it = st.begin(); it != st.end(); it++) cout << *it << endl;
return 0;
}