LONGSEQ: Solution not getting accepted

Can anybody please let me know what is the flaw in my program due to which I am getting wrong answer.

My solution: https://www.codechef.com/viewsolution/19262279

Your solution fails in case the length of the input is 1 (or in other words, if the number of digits in the number is one).

Just add another condition to handle it before calculating the indexes

if(str.length() == 1) {
    System.out.println("Yes");
    continue;
}

Hope it helps.

yes, it worked.
Thank you very much…