Please help me!!! Iam dying with the wrong answer

I tried to solve this problem
but i don’t know why i am getting wrong answer.
I tried everything,but unable to find the mistake

So please help me in finding my mistake

link to my code Solution

no one would have patience to read question and check my code.

But I hope someone out there have…

Your input of the string is not working properly.
Take the string as input at once only, don’t run the loop.