MY name is ruhul amin

ISLAMIC UNIVERSITY OF KUSHTIA

Saturday, March 2, 2013

uva solve problem 10945_mother bear

#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main()
{
    char a[100000],b[100000];
    int i,j,la,l,k,m,c;
    while(gets(a)!=NULL)
    {
        la=strlen(a);
        j=0;
        m=0;
        if((a[m]=='D')&&(a[m+1]=='O')&&(a[m+2]=='N')&&(a[m+3]=='E'))
        break;
        for(i=0;i<la;i++)
        {
            if(isalpha(a[i]))
            b[j++]=a[i];
        }
        l=0;
        c=0;
        for(k=j-1;k>=0;k--)
        {
            if(tolower(b[k])==tolower(b[l]))
            l++;
            else
            c=c+1;
        }
        if(c>0)
        printf("Uh oh..\n");
        else
        printf("You won't be eaten!\n");
    }
    return 0;
}

No comments:

Post a Comment