Your name is mine

I also recommend you better formatting of your code (unless the formatting changed after you submitted your solution), because it is very illegible. E.g. the indentation of the corresponding braces { and } should be the same. Your code also has one redundant part, you could e.g. check which string is shorter and assign them accordingly to “shorter” and “longer” variables, then you can eliminate the redundant part.

What is wrong with this: http://ww2.codechef.com/viewsolution/2147760 . It has been 3 days but I havn’t been able to figure it out.

can anyone verify my code pleasehere

nevermind. We all are in learning phase. Good Luck for future.

I have edited my answer for a shortcut to indent fast.

@yogeshpoddar >> From the first sight: increase the array size by 1 each, and you also need to include string.h header.

Can you tell me what is this?

printf("\n");
for(i=0;i<T;i++)
{
	if(ans[i]==1) printf("YES");
	else printf("NO");
	if(i==T-1) break;
	else
	printf("\n");

}

I think this leads to WA…

@betlista >> Nope, thats fine. See the calculation part for ans[]. Also have a look here http://ideone.com/DzPJwV

My point was, that he prints empty line first and there is no new line character after the last line (but this is not a problem probably)…

I was getting the correct answers earlier for all the cases I tried. I think there is some other kind of error . Though I have incorporated the string.h and increased the array size.

@betlista >> The first empty line won’t matter, 'cause output starts off on a new line anyway. Regarding not printing last line, again no probs. Check the link again and try commenting/uncommenting line #13 and #54. Also, I guess if we print more than 1 newlines in this problem, judge might accept, if the program is written to skip blank spaces. In some problems it is specifically mentioned. Can’t test on here, as “access denied”. If you can, then please check and tell.

@bugkiller >> I have tried the space things while uploading my answer. But every time it showed wrong, while it worked absolutely fine on my machine.

Have you tried submitting again with increased array sizes?

There is no submission button now.

Yes, then wait till it comes back and tell if you still get the same problem. Or if you’re not getting “access denied” page unlike me then you can go to the submit page by tampering the URL of the problem like this http://ww2.codechef.com/problems/submit/NAME2/

It still gives wrong answer. :frowning:

then will have a look on it after dinner. bbl.

Ok. Please have a look please.! :frowning:

it prints YES for

1
abc axxb
1 Like

@yogeshpoddar >> your code is printing wrong results for inputs. I am observing your code. Meanwhile, you can check my solution CodeChef: Practical coding for everyone