Getting EOF error on line 1

I am getting EOF error but the code is running fine on my IDLE

Your doubt was reopened. Is it resolved?

No it is not resolved

Try cout<<endl; instead of cout<<"\n"
It might be the reason, I suppose!

I have written the solution in python

@tushaartiwari1997
I don’t know the python well (but I know basics),
but you can refer


this https://airbrake.io/blog/python-exception-handling/eoferror

Is my logic correct?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.