安迪的第一个字典 (Andy's First Dictionary,UVa10815)

题目描述:

安迪的第一个字典 (Andy's First Dictionary,UVa10815)

#include<iostream>
#include<string>
#include<set>
#include<sstream>
using namespace std; set<string> dic;
string s, buf; int main() {
while(cin >> s) {
for(int i = ; i < s.length(); i++)
if(isalpha(s[i])) s[i] = tolower(s[i]); else s[i] = ' ';
stringstream ss(s);
while(ss >> buf) dic.insert(buf);
}
for(set<string>::iterator it = dic.begin(); it != dic.end(); ++it)
cout << *it << "\n";
return ;
}
上一篇:UVA - 10815 - Andy's First Dictionary STL


下一篇:UVA-10815 Andy's First Dictionary (非原创)