this is my code........plz give me any test case where my code
fails.........i am reaptedly getting WA

link is https://www.spoj.pl/problems/CENCRY/

# include<cstdio>
# include<cstring>
char a[]="aeiouaeiouaeiouaeioua";
char b[]="bcdfghjklmnpqrstvwxyz";
int search(char a1)
{
        int i;
        if(a1=='a'||a1=='e'||a1=='i'||a1=='o'||a1=='u')
        {
                for(i=0;i<5;i++)
                if(a1==a[i])
                {return i;break;}
        }
        else
        {
                for(i=0;i<22;i++)
                if(a1==b[i])
                {return i;break;}
        }
}


int main()
{

        int l1=strlen(a);
        int l2=strlen(b);

        char c[60000];
        int t;
        scanf("%d",&t);
        int j;
        for(j=0;j<t;j++)
        {       int d[1000];
                int pos=0;
                scanf("%s",c);
                int i;
                for(i=0;i<200;i++)
                d[i]=-1;
                for(i=0;c[i]!='\0';i++)
                {
                        d[c[i]]++;
                        pos=search(c[i]);

if(c[i]=='a'||c[i]=='e'||c[i]=='i'||c[i]=='o'||c[i]=='u')
                        {
                                printf("%c",b[(pos+d[c[i]]*5)%21]);
                                //printf("  %d\n",(pos+d[c[i]]*5)%21);
                        }
                        else if (d[c[i]]==0)
                        printf("%c",a[pos]);
                        else
                        printf("%c",a[pos+(d[c[i]]*21+d[c[i]])%21]);
                }
                printf("\n");
        }
return 0;
}

plzz help me..

-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to