UVa-10815 - Andy's First Dictionary

算是抄袭代码

#include<iostream>
#include<set>
#include<string>
#include<sstream>
using namespace std;
set<string> dict;
int main()
{
    string s,buf;
    while(cin>>s)
    {
        int l=s.size();
        for(int i=0;i<l;i++)
        {
            if(!isalpha(s[i])) s[i]=' ';
            else if(isupper(s[i])) s[i]=tolower(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;
}

posted on 2015-04-01 21:27  windrises  阅读(127)  评论(0编辑  收藏  举报

导航