Sunday, June 26, 2016

UVA 10815 Solution

Unknown
#include<bits/stdc++.h>
using namespace std;

int main()
{
    set<string> ss;
    char line[205];
    while (gets(line))
    {
        int l=strlen(line);
        for (int i=0;i<l;i++)
        {
            if (line[i]>='A' && line[i]<='Z') line[i]+=32;
        }
        for (int i=0;i<l;i++)
        {
            int j=0;
            string s="";
            while (j<l && line[i]>='a' && line[i]<='z')
            {
                s+=line[i];
                i++;
                j=1;
            }
            if (j)
            {
                ss.insert(s);
                i--;
            }
        }
    }
    set<string> :: iterator it;
    for (it=ss.begin();it!=ss.end();it++) cout<<*it<<endl;
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,