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;