UVA - 10815 Andy's First Dictionary

Posted NWU_ACM

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UVA - 10815 Andy's First Dictionary相关的知识,希望对你有一定的参考价值。

 1 #include <iostream>
 2 #include <cstring>
 3 #include <algorithm>
 4 #include <set>
 5 using namespace std;
 6 
 7 set<string> out;
 8 
 9 int main()
10 {
11     string s,temp;
12     while(cin>>s)
13     {
14         int len(s.size());
15         for(int i=0;i<len;i++) s[i] = tolower(s[i]);
16         temp.clear();
17 
18         for(int i=0;i<len;i++)
19         {
20             if(\'a\'<=s[i]&&s[i]<=\'z\') temp.push_back(s[i]);
21             else
22             {
23                 if(temp.size() != 0)
24                 {
25                     out.insert(temp);
26                     temp.clear();
27                 }
28             }
29             if(i == len - 1)
30             {
31                 if(temp.size() != 0)
32                 {
33                     out.insert(temp);
34                 }
35             }
36         }
37     }
38     for(set<string>::iterator it=out.begin();it!=out.end();it++)
39         cout<<*it<<endl;
40 }
View Code

 

以上是关于UVA - 10815 Andy's First Dictionary的主要内容,如果未能解决你的问题,请参考以下文章

Uva 10815.Andy's First Dictionary

UVA - 10815 Andy's First Dictionary

安迪的第一个字典 Andy's First Dictionary, UVa 10815

UVa10815 Andy's First Dictionary (STL)

uva 10815,andy's first ditionary(set,stringstream的简单运用)

UVA - 10815Andy's First Dictionary (set)