UVa 10815: Andy's First Dictionary

来源:互联网 发布:ppt软件图标 编辑:程序博客网 时间:2024/05/22 00:26
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <sstream>#include <string>#include <set>#include <cstring>using namespace std;int main(){    set<string> dict;    string in_s;    while(cin >> in_s)    {        for(unsigned int i = 0; i < in_s.length(); i++)        {            if(isalpha(in_s[i]))                in_s[i] = tolower(in_s[i]);            else                in_s[i] = ' ';        }           stringstream ss(in_s);        string buf;        while(ss >> buf) // ignore blank            dict.insert(buf);    }       for(set<string>::iterator it = dict.begin(); it != dict.end(); it++)    {        cout << *it << endl;    }       return 0;}
0 0
原创粉丝点击