http://www.codechef.com/viewsolution/2376002 … is generating WA… i have checked for a few cases and works fine… but can’t figure out why generating wrong answer http://ideone.com/HvHw4E
One thing you need to change is to make the array declaration to arr[51][51] as the string would need a place to store ‘\0’ character.It worked for me but your solution is still giving WA even after changing.Try a few more cases.
1 Like
‘\0’ is only when we take input through gets… here i am using scanf, so arr[50][50] should work perfectly… don’t know what’s still wrong with it…