Files
python/RuMenJingDian/UVa/UVa10815.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

27 lines
767 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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