Please HELP me to correct code

https://www.codechef.com/viewsolution/19356822

I performed an addition of ASCII code of each character of the two substrings of string and then compared the sum of ASCII values of both substrings.

Problem link:

Sum of ASCII can be deceiving. ‘ad’ and ‘bc’ will have same sum afaik.

Thank you for helping.I was really frustrated