Code: Select all
#include <iostream>
#include <string>
#include <map>
#include <cctype>
using namespace std;
map<string, int> g_dict;
int main() {
string strIn;
while (cin >> strIn) {
string temp;
for(int i = 0; i < strIn.size(); i++) {
temp += (char)tolower(strIn[i]);
if (!isalpha(temp[i])) {
temp[i] = ' ';
}
}
strIn.clear();
for (int i = 0; i < temp.size(); i++) {
if (isalpha(temp[i])) {
strIn += temp[i];
}
}
g_dict[strIn] = 1;
}
for (map<string, int>::iterator itr = g_dict.begin();
itr != g_dict.end();
itr++
) {
cout << itr->first << endl;
}
return 0;
}