Strings Difference in Ascii Code

What is wrong in the code. Not able to understand where the code is wrong , not giving correct output.

Check now =>

Here is my code that is updated after getting my mistake but this is not passing testcases, so what is wrong there :- https://ide.codingblocks.com/s/405859

Just do this, instead of this all test cases will be passed.

//getline(cin,s);
	cin>>s;

The testcases are still not passing. And another doubt why is it wrong to take input via getline(cin, s) and not by cin >> s, as you said if i do it like cin >> s, then all test cases will pass?

when you will use getline(cin, s) then it will take input as a line consisting of different strings until a new string from next line is given. For eg: if string will be like this:

adbbd ajsndjk asjdj

then it will take s = adbbd ajsndjk asjdj
and then it will operate but we have to take input by of adbbd only.
So that’s why you are getting wrong answer cause string s should be adbbd but by getline it’s being adbbd ajsndjk asjdj

do this and all your test cases will be passed. 

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.