getting WA link:SPOJ.com - Problem OAE here is my solution
your code gives wrong answer for the following case :-
correct code output
your code output
i want to know what is wrong with my logic