Please HELP me to correct code

Search forum. This question is already answered many times. Also explain your approach when you ask question. And add question link.

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