Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

LCPESY : Getting WA

$
0
0

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, asciisizeof(a1)); memset(b1, 0, asciisizeof(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;

} `


Viewing all articles
Browse latest Browse all 39796

Trending Articles