您的位置:首页 > 其它

Uva10815——Andy's First Dictionary

2015-10-24 20:32 309 查看
#include <iostream>
#include <string>
#include <set>
#include <sstream>
using namespace std;

set<string> dict;

int main()
{
//	freopen("10815.txt", "r", stdin);
string s, buf;
while(cin >> s)
{
for(int i = 0; i < s.length(); i++)
if(isalpha(s[i]))
s[i] = tolower(s[i]);
else
s[i] = ' ';

stringstream ss(s);
while(ss >> buf)
dict.insert(buf);
}
for(set<string>::iterator it = dict.begin(); it != dict.end(); it++)
cout << *it << endl;
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: