Wednesday, July 20, 2016

uva 12243 solution

Unknown
#include<cstdio>
#include<cstring>
#include<set>
#include<cctype>
using namespace std;

int main()
{
    char s[5000];
    while (gets(s))
    {
        if (!strcmp(s,"*")) return 0;
        int t=1;
        int l=strlen(s);
        set < char > cs;
        for (int i=0;i<l;i++)
        {
            if (s[i]==' ') t=1;
            if (t && s[i]!=' ')
            {
                cs.insert(tolower(s[i]));
                t=0;
            }
        }
        if (cs.size()==1) printf("Y\n");
        else printf("N\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,