Required python solution

I want to know the python solution for the same question

Hey @aditya.ameya, here is the python solution.

Hope this resolved your doubt.
plz mark the doubt as resolved in my doubts section. :blush:

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.

Traceback (most recent call last):
File “script.py”, line 15, in
n = int(input())
EOFError: EOF when reading a line
I am getting this in the IDE , can you help me on this

Hey @aditya.ameya, while running code on ide you need to provide custom input first. So click on input tab next to run. Provide the custom input on which you wish to run your code. And then click on run button.