ACM

UVA 10815



Uva 10815
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s = “”;
char ch;
set<string> r;
set<string>::iterator it;
    while(1) {
ch=getchar();
if(ch == -1)
break;
        //cout << ch ;
if(isalpha(ch))
s.push_back(tolower(ch));
else {
if(s.size()!=0) {
r.insert(s);
//cout<<s<<“” << r.size()<<endl;
s = “”;
}
}
    }
if(s.size()!=0)
r.insert(s);
for(it = r.begin(); it!=r.end();it++)
cout<<*it<<endl;
return 0;
}

Leave a Reply

Your email address will not be published.

four − 4 =