知识点:模拟
这道题又卡了,但是udubg上面的样例过了就发了,不得不说STL很好用,4分钟就解决了
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
set<string> st;
while (getline(cin, s)) {
for (int i = 0; i < (int) s.size(); i++) {
if (!isalpha(s[i])) s[i] = ' ';
else s[i] = tolower(s[i]);
}
stringstream ss(s);
string temp;
while (ss >> temp) st.insert(temp);
}
for (set<string>::iterator it = st.begin(); it != st.end(); it++) cout << *it << endl;
return 0;
}