I am having problem in taking input properly. My solution is correct. I have tried with various inputs test cases but I keep getting NZEC error when I submit it.
This is my code: https://ideone.com/FQU94J
It works fine in IDE online but when I submit it, it gives me runtme error. I think there is some problem while taking input. Please help anyone!!