LCPESY : Getting WA

Please help me find what is wrong with this code

#include<stdio.h>
#define size 10000
#define ascii 123

int main(){
int t,j;
char a[size];
char b[size];
int a1[ascii],b1[ascii];
long long int i,sum;

scanf("%d",&t);
    for(j=0;j<t;j++){
            sum=0;
            memset(a1, 0, ascii*sizeof(*a1));
            memset(b1, 0, ascii*sizeof(*b1));

        scanf("%s",&a);
        scanf("%s",&b);

            i=0;
            while(a[i] != 0){
                a1[a[i]]++;
                i++;
            }

            i=0;
            while(b[i] != 0){
                b1[b[i]]++;
                i++;
            }
            for(i=65;i<123;i++){
                    if(a1[i]>0 && b1[i]>0){
                        if(a1[i]<b1[i]){
                            sum=sum+a1[i];
                        }

                        else{
                            sum=sum+b1[i];
                        }
                    }

            }
            printf("%lld\n",sum);

    }
     return 0;

}

size should be 10001 to accommodate the '\0' at the end when |A| or |B| = 10000

Accepted submission:
http://www.codechef.com/viewsolution/3932332

1 Like

Request you to continue the discussion on the editorial page of the problem. Closing this question as of now.