Sir pls tell whats the error in this code.. one test case is not passing

@Vaibhav277,
s.length() is not a valid index, range of a string index is [0,s.length()-1]

sir still last test case is not passing… pls check it

sir ppls tell whats wrong in the code

@Vaibhav277,
Link of updated code…?

sir I tried what u said… can u make changes if in my code and send it to me…

@Vaibhav277,
No one would benefit, if I just provide everyone with codes. Code it yourself, share the link of the code here, I will point out bugs, or give hints, then you solve the problem yourself.
So, please share the link of the corrected code, that you tried.

output is coming absolutely right… but test cases are not passing … pls tell whats the error… i am not asking u to write code and send it to me… i am just asking for ur help to make corrections in my code

@Vaibhav277,
Corrected code here

(int)s.length() - 1… can u pls explain why here u have used int before s.length

@Vaibhav277,
It’s a precautionary practice, because *.length() returns unsigned int, so one should explicitly convert it to (int).

okay… thank you sir