I ran the code given below on Ideone and on Xcode (an IDE on mac). Shockingly, they gave me two different answers for the test cases given along with the problem.
Ideone shows "Nana". Whereas Xcode shows "Nobody wins".
Ideone:
Xcode:
Ideone is showing an incorrect answer. Codechef is giving a WA too. What can the reason be for this discrepancy?
My code: http://ideone.com/QWFdC7 EDIT: Latest code - http://ideone.com/BBNQKi