Files
python/RuMenJingDian/UVa/UVa10815.cpp

27 lines
767 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}