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.

27 lines
741 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}