You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
set<string> dict;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
string s, b;
|
|
|
|
|
while (cin >> s) {
|
|
|
|
|
for (int i = 0; i < s.length(); i++) {
|
|
|
|
|
if (isalpha(s[i]))//isalpha()判断是不是英文字符
|
|
|
|
|
{
|
|
|
|
|
s[i] = tolower(s[i]);//将大写转换为小写
|
|
|
|
|
} else
|
|
|
|
|
s[i] = ' ';
|
|
|
|
|
}
|
|
|
|
|
stringstream ss(s);//从string对象str中读取字符,头文件#include<sstream>
|
|
|
|
|
//有空格就是下一个
|
|
|
|
|
while (ss >> b)
|
|
|
|
|
dict.insert(b);//将b输入set中
|
|
|
|
|
}
|
|
|
|
|
//迭代输出
|
|
|
|
|
for (set<string>::iterator p = dict.begin(); p != dict.end(); p++)//迭代器,有点像指针
|
|
|
|
|
cout << *p << endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|