Calculating the length for which prefix is reverse of suffix
i = 0 NEW_LINE j = n - 1 NEW_LINE while i < j : NEW_LINE INDENT if ( s [ i ] != s [ j ] ) : NEW_LINE INDENT break NEW_LINE DEDENT i += 1 NEW_LINE j -= 1 NEW_LINE length += 1 NEW_LINE DEDENT