My code is perfectly correct but I get WA on SPOJ. I think it is because i initialized t to 10 and ran a loop. Help please!


Yes you are right your code is “perfectly correct”. You just need to increase the size of both the char arrays since 10^100 has 101 characters(including 1) so you need an array of size 102(minimum) instead of 101. Your corrected code is here

1 Like

thanks! didn’t think of it… just btw how do you take multiple inputs with scanf? like without initialising t to 10

while(scanf("%s %s",a,b)==2)
//insert your code here