Can anyone tell me what is wrong with my problem?

Here is problem statement https://www.codechef.com/problems/LAPIN

Here is my code https://www.codechef.com/viewsolution/26318940

# Help with a problem - LAPIN

You are using sum as the comparing logic which is not the correct approach. Try it for these strings:

adxbc

iljk

wzaxy

These should be NO but give output as YES because according to your code,

sum(ad) = sum (bc)

sum(il) = sum(jk)

sum(wz) = sum(xy)

Hope you understand the mistake.

1 Like

i didn’t considered all the possibilities, yes i got it.