Can someone please tell me why my code fails on problem D of Atcoder Beginner Contest? Here is the link to my code: https://atcoder.jp/contests/abc043/submissions/10192786 and here is the link to the problem: https://atcoder.jp/contests/abc043/tasks/arc059_b .
Does not work on strings of length 2
Thank you very much!