Problem:


Score : 200 points

Problem Statement

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.

Constraints

S consists of lowercase English letters.

The length of S is an odd number between 3 and 99 (inclusive).

Input

Input is given from Standard Input in the following format:

S

Output

If S is a strong palindrome, print Yes;
otherwise, print No.

Sample Input 1

akasaka

Sample Output 1

Yes

S is akasaka.

The string formed by the 1-st through the 3-rd characters is aka.

The string formed by the 5-th through the 7-th characters is aka.
All of these are palindromes, so S is a strong palindrome.

Sample Input 2

level

Sample Output 2

No

Sample Input 3

atcoder

Sample Output 3

No



Sample input:
akasaka


Sample output:
Yes

Submission status: Accepted

Solution code:
s = input()
strong = True
for i in range(int(len(s)/2)):
  if s[i] != s[len(s)-1-i]:
    strong = False
p = int((len(s)-1)/2)
for i in range(int(p/2)):
  if s[i] != s[p-1-i]:
    strong = False
if len(s) >= 5:
  q = int((len(s)+3)/2)
  for i in range(len(s)-q):
    if s[q+i-1] != s[len(s)-1-i]:
      strong = False
if strong == True:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
rev = s[::-1]
hd = (n-1)//2
tl = (n+3)//2
if s==rev:
    s_hd = s[:hd] 
    s_tl = s[tl-1:]
    h_rev = s_hd[::-1]
    t_rev = s_tl[::-1]
    #print(s_hd)
    #print(s_tl)
    #print(h_rev)
    #print(t_rev)
    if s_hd==h_rev:
        if s_tl==t_rev:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
if (S == S[::-1] and S[: (N - 1) // 2:-1] == S[:(N - 1) // 2] and S[N:(N + 3) // 2 - 2:-1] == S[(N + 3) // 2 - 1:]):
    #print(S[::-1], S[: (N - 1) // 2:-1], S[N:(N + 3) // 2 - 2:-1])
    #print(S[::-1], S[:(N - 1) // 2], S[(N + 3) // 2 - 1:])
    print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
S = input()

def kaibunCheck(str):
    s = 0
    e = len(str)-1

    while(s < e):
        if(str[s]!=str[e]):
            return False
        s +=1
        e-=1
    return True


c = kaibunCheck(S) and kaibunCheck(S[0:(len(S)-1)//2])

if(c):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

s = input()
len_s = len(s)
kaibun = s == s[::-1]
left = s[:(len_s-1)//2] == s[:(len_s-1)//2][::-1]
right = s[(len(s)+3)//2-1:] == s[(len(s)+3)//2-1:][::-1]
log(kaibun, left, right)
print("Yes" if kaibun and left and right else "No")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
jj=((n-1)//2)
t=s[0:jj]
kk=((n+3)//2)-1
tt=s[kk:n+1]
if(t==t[::-1] and tt==tt[::-1] and s==s[::-1]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()

flag = True

for i in range(len(S) // 4):
    if(S[i] != S[len(S) // 2 - 1 - i]):
        flag = False

for i in range(len(S) // 2):
    if(S[i] != S[-i-1]):
        flag = False
if (flag):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
# print(s)
np = False
for i in range(n//2):
    if s[i] != s[n-1-i]:
        np = True
s2 = s[:n//2]
# print(s2)
n = len(s2)
for i in range(n//2):
    if s2[i] != s2[n-1-i]:
        np = True
n = len(s)
s2 = s[(n+3)//2-1:]
# print(s2)
n = len(s2)
for i in range(n//2):
    if s2[i] != s2[n-1-i]:
        np = True
if np:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
wf = input()
rwf = wf[::-1]

wl = wf[0:int((len(wf)-1)/2)]
rwl = wl[::-1]

wr = wf[int((len(wf)+3)/2-1):len(wf)]
rwr = wr[::-1]

if wf == rwf and wl == rwl and wr == rwr:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if (s == s[::-1] and s[: (n - 1) // 2] == s[: (n - 1) // 2][::-1] and s[(n + 3) // 2 - 1 :] == s[(n + 3) // 2 - 1 :][::-1]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
n= len(S)
ng = 0
s = 0
e = n
for i in range((e-s)//2):
  if S[s+i] != S[e-i-1]:
    ng = 1
nn = (n-1)//2
for i in range(nn//2):
  if S[i] != S[nn-i-1]:
    ng = 1
nn = (n+3)//2 - 1
for i in range((n-nn)//2):
  if S[nn+i] != S[n-i-1]:
    ng = 1
if ng == 1:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
ans = 'No'
N = len(S)
if S==S[::-1]:
    if S[0:(N-1)//2] == S[0:(N-1)//2][::-1]:
        if S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]:
            ans ='Yes'
print(ans)

Submission status: Accepted

Solution code:
def is_kaibun(s):
    l = len(s)
    for i in range(0, l):
        if s[i] != s[l-i-1]:
            return False
    return True

def is_strong_kaibun(s):
    n = len(s)
    s1 = s[:(n-1)//2]
    s2 = s[(n+3)//2-1:]

    return is_kaibun(s) and is_kaibun(s1) and is_kaibun(s2)


s = input()
ans = 'Yes' if is_strong_kaibun(s) else 'No'
print(ans)

Submission status: Accepted

Solution code:
from sys import exit

def kaibun(s):
    i = 0
    N = len(s)
    if N % 2 == 1:
        while i < (N - 1) // 2:
            if s[i] != s[N - 1 - i]:
                print("No")
                exit()
            i += 1
    else:
        while i < N // 2:
            if s[i] != s[N - 1 - i]:
                print("No")
                exit()
            i += 1


s = input()
s_1 = s[0: (len(s) - 1) // 2]
s_2 = s[(len(s) + 1) // 2:]
kaibun(s)
kaibun(s_1)
kaibun(s_2)
print("Yes")

Submission status: Accepted

Solution code:
s = input()
zenhan = s[:(len(s)-1)//2:]
san = s[(len(s)+3)//2-1:]
if s != s[::-1]:
    print('No')
elif zenhan != zenhan[::-1]:
    print('No')
elif san != san[::-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
# デバッグ用
GBN_DEBUG = False
GBN_DEBUG = True
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)

#本体ここから

S = input()
#N = int(input())
#S, T = input().split()
#N, M = map(int, input().split())
#W = [input() for _ in range(N)]
#A = A = list(map(int, input().split()))

def isKaibun(s):
    lenS = len(s)
    for i in range(lenS//2):
        if s[i] != s[-i-1]:
            return False
    return True

if isKaibun(S) == True:
    N = len(S)
    s_left = S[:(N-1)//2]
    s_right = S[(N+3)//2-1:]
    if isKaibun(s_left) and isKaibun(s_right):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)

l = s[0:int((n-1)/2)]
m = s[int((n+3)/2)-1:]

n_l = len(l)
n_m = len(m)
if all(s[i] == s[-i-1] for i in range(n//2)):
    if all(l[i] == l[-i-1] for i in range(n_l//2)):
        if all(m[i] == m[-i-1] for i in range(n_m//2)):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())

n = len(s)
ans = "Yes"
for i in range(n // 2):
    if s[i] != s[n-i-1]:
        ans = "No"
        #print("A")

m = (n - 1) // 2
#print(m)
for i in range(m // 2):
    if s[i] != s[m-i-1]:
        #print(i, m-i)
        ans = "No"
        #print("B")

k = (n + 3) // 2
for i in range(k, (n-k-1)//2):
    if s[i] != s[n+k-1-i]:
        ans = "No"
        #print("C")

print(ans)

Submission status: Accepted

Solution code:
S=input()
a=len(S)
ans=1
if S[0:a//2]!=S[a//2+1:a][::-1]:
  ans=0
b=(a-1)//2
A=S[0:a//2]
B=S[a//2+1:a]
if A!=A[::-1]:
  ans=0
if B!=B[::-1]:
  ans=0
if ans==1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
s1 = s[:int((n-1)/2)]
s2 = s[int((n+3)/2-1):]

def isk(st):
    return st == st[::-1]

print("Yes" if (isk(s) and isk(s1) and isk(s2)) else "No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
def palindrome(string):

    if(string == string[::-1]):

        return 0

    else:

        return 1

first = palindrome(s)
if(first == 0):
    second = palindrome(s[0:(n-1)//2])
    if(second == 0):
        third = palindrome(s[((n+3)//2)-1:n])
        if(third == 0):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
a=[]
for i in range(len(s)):
    a.append(s[i])
b=list(reversed(a))
cn=a[:((n-1)//2)]
c=list(reversed(a[:((n-1)//2)]))
d=list(reversed(a[(n+3)//2-1:]))
dn=a[(n+3)//2-1:]
if a==b and c==cn and d==dn:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S=input()
N=len(S)
s=S[:(N-1)//2]
t=S[(N-1)//2+1:]
if s==s[::-1] and t==t[::-1] and S==S[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = str(input())

n = len(s)
ans = 'Yes'

for i in range(n//2):
    if s[i] != s[-1-i]:
        ans = 'No'
        break

if ans == 'Yes':
    for j in range(n//2//2):
        if s[j] != s[(n-1)//2 -j -1]:
            ans = 'No'
            break

print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
f1 = True
for i in range(n//2):
    if s[i] != s[n-i-1]:
        f1 = False
f2 = True
for i in range((n-1)//4):
    if s[i] != s[(n-1)//2-1-i]:
        f2 = False
f3 = True
nn = n - (n+3)//2
for i in range(nn//2):
    if s[i] != s[n-i-1]:
        f3 = False
if f1 and f2 and f3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def check(S):
    T = S[::-1]
    return S == T

S = input()
N = len(S)

S1 = S[:N//2]
S2 = S[N//2+1:]
if check(S) and check(S1) and check(S2):
    Yes()
else:
    No()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
t=1
for i in range(n//2):
    if s[i]!=s[-1-i]:
        t=0
for i in range(n//4):
    if s[i]!=s[n//2-1-i]:
        t=0
if t==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
x = s[0:(n-1)//2] 
y = s[(n+3)//2-1:n]
if x == x[::-1] and y == y[::-1] and s == s[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n+1)//2:n]

if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)

if S != ''.join(list(reversed(S))):
    print('No')
    exit()

M = S[:(N - 1) // 2]
if M != ''.join(list(reversed(M))):
    print('No')
    exit()

M = S[(N + 3) // 2 - 1:]
if M != ''.join(list(reversed(M))):
    print('No')
    exit()

print('Yes')

Submission status: Accepted

Solution code:
S=input()
pre = (len(S)-1)/2
post = (len(S)+3)/2

if S[0:int(pre)] == S[int(post)-1:]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
p = (len(s) - 1) // 2
t = s[:p]
u = s[p+1:]

res = s == s[::-1] and t == t[::-1] and u == u[::-1]

print("Yes" if res else "No")

Submission status: Accepted

Solution code:
S = input()
first = S[:int((len(S)-1)/2)]
second = S[int((len(S)+3)/2-1):]
if first == ''.join(list(reversed(first))) and second == ''.join(list(reversed(second))) and first == ''.join(list(reversed(second))):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = list(input())
if s == s[::-1]:
    pass
else:
    print("No")
    exit()
x = s[0:int((len(s)-1)/2)]
if x == x[::-1]:
    pass
else:
    print("No")
    exit()
x = s[int((len(s)+3)/2)-1:len(s)]
if x == x[::-1]:
    pass
else:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
n=len(s)

ans=1

for i in range(int((n-1)/2)):
    if s[i]==s[int((n-1)/2)-1-i]:
        continue
    else:
        ans=0


for i in range(int((n+3)/2),n):
    if s[i]==s[n-1-i]:
        continue
    else:
        ans=0


for i in range(int((n-1)/2)):
    if s[i]==s[n-1-i]:
        continue
    else:
        ans=0
        break



if ans==1:
    print("Yes")
if ans==0:
    print("No")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
s1 = s[:l//2]
s2 = s[l//2+1:]
l1 = len(s1)
l2 = len(s2)
#print(s1)
#print(s2)
ans = "Yes"
for i in range(l//2):
 #   print(s[i:i+1],s[l-1-i:l-i])
    if s[i:i+1] != s[l-1-i:l-i]:
        ans = "No"
"""
for i in range(l//4+1):
    print(s[i:i+1],s[(l-1)//2-1-i:(l-1)//2-i],i,i+1,(l-1)//2-1-i,(l-1)//2-i)
    if s[i:i+1] != s[(l-1)//2-1-i:(l-1)//2-i]:
        ans = "No"
for i in range(l//4+1):
    print(s[(l+3)//2+i-1:(l+3)//2+i],s[l-1-i:l-i],(l+3)//2+i-1,(l+3)//2+i,l-1-i,l-i)
    if s[(l+3)//2+i-1:(l+3)//2+i] != s[l-1-i:l-i]:
        ans = "No"
"""
for i in range(l1//2):
   # print(s1[i:i+1],s1[l1-1-i:l1-i])
    if s1[i:i+1] != s1[l1-1-i:l1-i]:
        ans = "No"
for i in range(l2//2):
 #   print(s2[i:i+1],s2[l1-1-i:l1-i])
    if s2[i:i+1] != s2[l1-1-i:l1-i]:
        ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S=list(input())
N=len(S)
check=True
for i in range(N//2):
    if S[i]!=S[N-1-i]:
        check=False
        break
if check==False:
    print("No")
else:
    C=False
    for i in range((N//2)//2):
        if S[i]!=S[N//2-1-i]:#0123456
          C=True
          break
    if C==True:
        print("No")
    else:
        print("Yes")

Submission status: Accepted

Solution code:
def main():
    s = input()

    for i in range(len(s) - 1):
        if s[i] != s[-1 - i]:
            print('No')
            exit()

    for i in range((len(s) - 1)//2):
        if s[i] != s[(len(s) - 1)//2 - 1 - i]:
            print('No')
            exit()

    print('Yes')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
N = len(S)


a = S[:(N - 1) // 2]
b = S[(N + 3) // 2 - 1:]

ans = "No"
if S == S[::-1] and a == a[::-1] and b == b[::-1]:
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
for i in range(0,n//2):
    if s[i] != s[n-i-1]:
        print("No")
        break
else:
    for j in range(0,(n-1)//4):
        if s[i] != s[(n-1)//2-i-1]:
            print("No")
            break
    else:
        for k in range((n+3)//2-1,n//2):
            if s[(n+3)//2-1+i] != s[n-i-1]:
                print("No")
                break
        else:
            print("Yes")

Submission status: Accepted

Solution code:
def isPalind(s):
  return s == s[::-1]
  
if __name__ == "__main__":
  S = input()
  N = len(S)
  if isPalind(S) and isPalind(S[:(N - 1) // 2]) and isPalind(S[(N + 1) // 2:]):
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
S = input()


def kaibun(s):
    for i in range(len(s) // 2):
        if s[i] != s[len(s) - 1 - i]:
            return False
    return True


N = len(S)

if not kaibun(S):
    print('No')
    exit()
    
if not kaibun(S[:(N-1)//2]):
    print('No')
    exit()

if not kaibun(S[(N+3)//2 - 1:]):
    print('No')
    exit()

print('Yes')

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    S = INPUT()
    N = len(S)

    for i in range(N//2):
        if S[i] != S[N-1-i]:
            print("No")
            sys.exit()

    for i in range(N//2//2):
        if S[i] != S[(N-1)//2-1-i] or S[(N+3)//2-1+i] != S[N-1-i]:
            print("No")
            sys.exit()

    print("Yes")
            

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)

for i in range(N // 2):
    if S[i] != S[-i - 1]:
        print("No")
        quit()

S2 = S[: (N - 1) // 2]
N2 = len(S2)
for i in range(N2 // 2):
    if S2[i] != S2[-i - 1]:
        print("No")
        quit()

S3 = S[(N + 3) // 2 - 1:]
N3 = len(S3)
for i in range(N3 // 2):
    if S3[i] != S3[-i - 1]:
        print("No")
        quit()

print("Yes")

Submission status: Accepted

Solution code:
n=input()
s=len(n)
d=int((s-1)/2)
p=int((s+3)/2)
m=n[::-1]
n1=n[0:d]
n2=n1[::-1]
n3=n[p-1:]
n4=n3[::-1]
if n==m and n1==n2 and n3==n4:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
t = s[:(n-1)//2]
u = s[(n+3)//2-1:]
flg = (s == s[::-1]) and (t == t[::-1]) and (u == u[::-1])
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
import sys
INF = 10 ** 9
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)

def k(s):
    n = len(s)
    flag = True
    if n%2 == 0:
        l = n//2
    else:
        l = (n - 1)//2

    for i in range(l):
        if s[i] == s[n-i-1]:
            continue
        else:
            flag = False
            break
    return flag


def main():
    s = input()
    n = len(s)
    

    if k(s) and k(s[:((n-1)//2)]) and k(s[((n - 1)//2 + 1):]):
        print('Yes')
    else:
        print('No')
 


if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
S_rev = S[::-1]
N = len(S)
s_bef = S[:int((N-1)/2)]
s_bef_rev = s_bef[::-1]
s_aft = S[int((N+2)/2):]
s_aft_rev = s_aft[::-1]
if (S==S_rev)and(s_bef==s_bef_rev)and(s_aft==s_aft_rev):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
S_ar = S[::-1]
S_len = len(S)
a = (S_len-1)//2
b = (S_len+3)//2-1
S_a = S[0:a]
S_b = S[b:S_len]

if S == S_ar:
    if S_a == S_a[::-1]:
        if S_b == S_b[::-1]:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [list(input().split()) for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    s=list(input())
    n=len(s)
    l1=s[:(n-1)//2]
    l2=s[(n+3)//2-1:]
    if s==s[::-1] and l1==l1[::-1] and l2==l2[::-1]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
print('Yes' if (S == S[::-1]) and (S[:len(S)//2] == S[:len(S) //
                                                      2][::-1]) and (S[len(S)//2+1:] == S[len(S)//2+1:][::-1])else 'No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
l_ = int((n-1)/2)
l = s[:l_]
lv = l[::-1]
r_ = int((n+3)/2)
r = s[r_-1:]
rv = r[::-1]
if l != rv or l != lv or r != rv:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys

S = input()
N = len(S)

if S != S[::-1]:
    print('No')
    sys.exit()

S1 = S[:int((N-1)/2)]
S2 = S[int((N+1)/2):]
if S1 != S1[::-1]:
    print('No')
    sys.exit()
if S2 != S2[::-1]:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
m=int((n-1)/2)
r=1
for i in range (0,m):
  if s[i]!=s[m-1-i]:
    r=0
  elif s[i]!=s[m+1+i]:
    r=0
  elif s[i]!=s[2*m-i]:
    r=0
if r==1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n = input()
m = len(n)
if n == n[::-1]:
  k = n[0:(m-1)//2]
  l = n[(m+3)//2-1:m]
  if k == k[::-1]:
    if l == l[::-1]:
      print('Yes')
      exit()
print('No')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

s=list(ss())
chk=True
if s!=list(reversed(s)):
    chk=False

if s[0:(len(s)-1)//2] != list(reversed(s[0:(len(s)-1)//2])):
    chk=False
if s[(len(s)+3)//2 -1:1+(len(s)-1)] != list(reversed(s[(len(s)+3)//2-1:1+(len(s)-1)])):
    chk=False
    
if chk==False:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
def is_kaibunn(word):
  new_word = ''.join(list(reversed(word)))
  return word == new_word
  
S = input()
N = len(list(S))
if is_kaibunn(S) and is_kaibunn(S[0:int((N-1)/2)]) and is_kaibunn(S[int((N+3)/2 - 1):N]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def func(s):
    n = len(s)
    for i in range(n//2):
        if s[i] != s[n-i-1]:
            return False
    return True
s = input()
N = len(s)
s2 = s[:N//2]
s3 = s[N//2+1:]
if func(s) and func(s2) and func(s3):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

n = len(s)

h = int((n-1)/2)
t = int((n+3)/2 - 1)

head = s[:h]

tail = s[t:]


if s == s[::-1] and head == head[::-1] and tail == tail[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
if s[::-1]==s and s[:(n-1)//2][::-1]==s[:(n-1)//2] and s[(n+3)//2 -1  :][::-1]==s[(n+3)//2 -1 :]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)


def is_parindrome(s, i, j):
    string = s[i:j]
    n = len(string)
    for i in range(n//2):
        start = i
        end = n - i - 1
        if string[start] != string[end]:
            return False
    return True


def main():
    S = input()
    N = len(S)
    if is_parindrome(S, 0, N) and is_parindrome(S, 0, (N - 1)//2) and is_parindrome(S, (N + 3) // 2 - 1, N):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
n = len(s)
s1 = s[:(n-1)//2]
s2 = s[((n+3)//2-1):]
is_kaibun = lambda x: x==x[::-1]
if is_kaibun(s) and is_kaibun(s1) and is_kaibun(s2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
s_rev = s[::-1]
ans = "Yes"
if not s == s_rev:
  ans = "No"
t = s[:(len(s)-1)//2]
t_rev = t[::-1]
if not t == t_rev:
  ans = "No"
print(ans)

Submission status: Accepted

Solution code:
#def main(S, b):
if __name__ == '__main__':
    # n, m = map(int, input().split())
    s = input()
    n = len(s)

    flug = 1
    for i in range((len(s) - 1) // 2):
        if (s[i] != s[n - 1 - i]):
            flug = 0
            break
    if (flug):
        t = s[:(n - 1) // 2]
        for i in range(len(t) // 2):
            if (t[i] != t[len(t) - 1 - i]):
                flug = 0
        u = s[(n + 3) // 2 - 1:]
        for i in range(len(u) // 2):
            if (u[i] != u[len(u) - 1 - i]):
                flug = 0
        # print(t)
        # print(u)
    if (flug == 1):
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
s=str(input())
n=len(s)
for i in range((n-1)//2):
    if s[i]!=s[-(i+1)]:
        print("No")
        exit()
if s[:(n-1)//2]!=s[((n-1)//2)+1:]:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
#input = sys.stdin.readline

def main():
    s=list(input())
    n=len(s)
    ans='Yes'
    for i in range((n-1)//2):
        if s[i]!=s[n-1-i]:
            ans='No'
            break
        if s[i]!=s[(n-1)//2-1-i]:
            ans='No'
            break
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

res = 'Yes'
if s != s[::-1]:
    res = 'No'
t = s[:(len(s)-1)//2]
if t != t[::-1]:
    res = 'No'
u = s[((len(s)+3)//2)-1:len(s)]
if u != u[::-1]:
    res = 'No'

print(res)

Submission status: Accepted

Solution code:
string = str(input())
N = len(string)
zenhan = string[:int((N-1)/2)]
kouhan = string[int((N-1)/2)+1:]

def IsKaibun(string):
    if string == string[::-1]:
        return True
    else:
        return False
      
if IsKaibun(string) and IsKaibun(zenhan) and IsKaibun(kouhan):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
srev = list(reversed(s))
a = s[:(n-1)//2]
arev = list(reversed(a))
b = s[(n+3)//2-1:]
brev = list(reversed(b))
if s == srev and a == arev and b == brev:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def kaibun(s):
    l = len(s)
    # print(l)
    for i in range(l//2):
        # print(s[i],s[l-i-1])
        if s[i] != s[l-i-1]:
            return False
    return True

s = input()
N = len(s)

# print(kaibun(s))

if kaibun(s) and kaibun(s[:(N-1)//2]) and kaibun(s[(N+3)//2-1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
t=True
for i in range(0,len(s)//2):
    if s[i]!=s[len(s)-i-1]:
        print("No")
        exit()

for j in range(0,((len(s)-1)//2)//2):
        if s[j]!=s[((len(s)-1)//2)-j-1]:
            print("No")
            exit()

for j in range(0,((len(s)-1)//2)//2):
        if s[len(s)-j-1]!=s[len(s)-((len(s)-1)//2-j)]:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
x=s[:((n-1)//2)]
y=s[((n+3)//2)-1:]
if s==s[::-1]:
        
    if x==x[::-1] and y==y[::-1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

n = len(s)
half = (n-1)//2
flag = True
l = 0
r = n - 1
while l <= r:
  if s[l] != s[r]:
    flag = False
    break
  l += 1
  r -= 1
  
l = 0
r = half - 1
while l <= r:
  if s[l] != s[r]:
    flag = False
    break
  l += 1
  r -= 1

l = half + 1
r = n - 1
while l <= r:
  if s[l] != s[r]:
    flag = False
    break
  l += 1
  r -= 1
  
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = list(input())
s_r = list(reversed(s))
n = int((len(s) - 1) / 2)
ss = s[:n]
ss_r = list(reversed(ss))
if s == s_r:
    if ss == ss_r:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)

#def my_index_multi(l, x):
#    return [i for i, _x in enumerate(l) if _x == x]

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    ans=YES
    cent=len(S)//2
    for i in range(cent):
        if S[i] != S[-i-1]:
            ans = NO
        if S[i] != S[cent-i-1]:
            ans = NO

    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

n = len(s)
f = int((n-1)/2)
b = int((n+3)/2)

s_r = s[::-1]

s_f = s[:f]
s_f_r = s_f[::-1]

s_b = s[b-1:n]
s_b_r = s_b[::-1]

#print(s_b)

if(s_r == s and s_f == s_f_r and s_b == s_b_r):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ok = True

def judge(s):
    # print(s)
    return 1 if s == s[::-1] else 0

if not judge(s):
    ok = False

if not judge(s[:((n-1)//2)]):
    ok = False

if not judge(s[((n+3)//2)-1:]):
    ok = False

if ok:
    print('Yes')
else:
    print('No')
# print(judge(s))

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    readline=stdin.readline
    S=readline().strip()
    N=len(S)
    M=N//2

    if S==S[::-1] and S[:M]==S[:M][::-1] and S[M+1:]==S[M+1:][::-1]:
        print("Yes")
    else:
        print("No")
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
flg = 0
for i in range(len(s)//2):
  if s[i] == s[-i-1]:
    pass
  else:
    flg = 1
s = s[:len(s)//2]
for i in range(len(s)//2):
  if s[i] == s[-i-1]:
    pass
  else:
    flg = 1
if flg == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(S):
    if S != "".join(reversed(S)):
        return "No"
    s1 = S[0:(len(S)-1)//2]
    if s1 != "".join(reversed(s1)):
        return "No"
    s2 = S[(len(S)+1)//2:]
    if s2 != "".join(reversed(s2)):
        return "No"
    return "Yes"


if __name__ == "__main__":

    # S
    #
    S = input()
    ans = solv(S)

    print(ans)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
s = S[::-1]
A = S[:(N-1)//2]
a = A[::-1]
B = S[(N+3)//2-1:]
b = B[::-1]

if S==s and A==a and B == b:
    print("Yes")
else:
    print("No")