Tuesday, July 19, 2016

UVA 10945 Solution

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

int main()
{
    char s[500],s1[500],c;
    while (gets(s))
    {
        if (!strcmp(s,"DONE")) return 0;
        int l=strlen(s);
        int k=-1;
        for (int i=0;i<l;i++)
        {
            c=tolower(s[i]);
            if (c>='a' && c<='z') s1[++k]=c;
        }
        int flag=1;
        for (int i=0;i<k;i++,k--)
        {
            if (s1[i]!=s1[k])
            {
                flag=0;
                break;
            }
        }
        if (flag) printf("You won't be eaten!\n");
        else printf("Uh oh..\n");
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,