Output not coming

My code:-

Hey @Aditya-Singh-2525648000999450
I checked the code and you are getting output
If your query is resolved please close it

But the output is wrong
Screenshot of output

@Aditya-Singh-2525648000999450
Silly mistake buddy
You forgot to take key,reversal,ordering input

I took input but still the output is same

@Aditya-Singh-2525648000999450
You closed your loop incorrectly
Remove " } " from line 60
Put it in line 54
Rest of the code is fine

Kindly close the doubt