Problem: A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied:    * S is a palindrome.   * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.   * The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.  Determine whether S is a strong palindrome.

Submission attempts (in order):
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    S = IS()
    N = len(S)
    if N%2 == 1:
        a = N//2
        if S[:a] == S[a+1:][::-1]:
            b = (N-1)//4
            if b%2 == 1:
                if S[:b] == S[b:a][::-1]:
                    c = (N+3)//2; d = c+(N-c)//2
                    if d%2 == 1:
                        if S[c-1:d-1] == S[d-1:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(7, S, N)
                    else:
                        if S[c-1:d] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(6, S, N)
                #else: print(8, S, N)
            else:
                if S[:b] == S[b+1:a][::-1]:
                    c = (N+3)//2; d = c+(N-c)//2
                    if d%2 == 1:
                        if S[c-1:d-1] == S[d-1:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(5, S, N)
                    else:
                        if S[c-1:d] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(4, S, N)
                #else: print(3, S, N)
        #else: print(2, S, N)
    #else: print(1, S, N)
    print('No')

if __name__ == '__main__':
    main()

import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    S = IS()
    N = len(S)
    if N%2 == 1:
        a = N//2
        if S[:a] == S[a+1:][::-1]:
            b = (N-1)//4
            if a%2 == 0:
                if S[:b] == S[b:a][::-1]:
                    c = (N+3)//2; d = c+(N-c)//2
                    if (N-c)%2 == 0:
                        if S[c-1:d-1] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(7, S, N)
                    else:
                        if S[c-1:d] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(6, S, N)
                #else: print(8, S, N)
            else:
                if S[:b] == S[b+1:a][::-1]:
                    c = (N+3)//2; d = c+(N-c)//2
                    if (N-c)%2 == 0:
                        if S[c-1:d-1] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(5, S, N)
                    else:
                        if S[c-1:d] == S[d:][::-1]:
                            print('Yes')
                            sys.exit()
                        #else: print(4, S, N)
                #else: print(3, S, N)
        #else: print(2, S, N)
    #else: print(1, S, N)
    print('No')

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted