Can anyone one help me why i am getting wrong ans despite getting correct output

I read your solution, you did not gave newline after each output. But that was just one part of mistake, still WA. Then i logically read your code. As far as i can see your your approach is wrong

You should try again :smile: