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:

def main():
    char_s = input()

    char_len = len(char_s)
    char_first = char_s[0:int((char_len-1)/2)]
    char_second = char_s[int((char_len+3)/2-1):char_len]

    flg_a = is_kaibun(char_s)
    flg_b = is_kaibun(char_first)
    flg_c = is_kaibun(char_second)

    if (flg_a==1) & (flg_b==1) & (flg_c==1):
        print('Yes')
    else:
        print('No')

def is_kaibun(str):

    strlen = len(str)
    for k in range(int(strlen/2)):
        if str[k] == str[strlen-k-1]:
            continue
        else:
            return 0

    return 1

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def palindrom(st):
    return st == st[::-1]
import math
s = input()
l = len(s)
print("Yes" if palindrom(s) and palindrom(s[:(l-1)//2]) and palindrom(s[(l+2)//2:]) else "No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
N1 = int(((N-1)/2)-1)
N2 = int(((N + 3)/2)-1)
A = S[:N1+1]
B = S[N2:]
BB = B[::-1]
C = 0
n = len(A)
nn = int(n/2)
nnn = int((n-1)/2)

if A == BB:
  C += 1
  
if n%2 == 0:
  AA = A[nn:]
  if A[:nn] == AA[::-1]:
    C += 1
elif n%2 ==1:
  AAA = A[nnn+1:]
  if A[:nnn] == AAA[::-1]:
    C += 1
    
if C == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a = str(input())
b =len(a)
c = (b-1)/2
d = (b+3)/2
E = list(a)
R = list(reversed(E))
F = "".join(R)
A = list(a[0:int(c)])
X = list(reversed(A))
S = "".join(X)
B = list(a[int(d-1):int(b+1)])
Y = list(reversed(B))
Q = "".join(Y)
if a[0:int(c)] == S and a[int(d-1):int(b+1)] == Q and a == F :
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
halfS = int((N-1)/2)
rev_S = list(reversed(S))
#S_1 = S[0:halfS]
#S_2 = rev_S[0:halfS]
S__1 = ''.join(S)
S__2 = ''.join(rev_S)
if S__1 == S__2:
    T = S[0:halfS]
    rev_T = list(reversed(T))
    T__1 = ''.join(T)
    T__2 = ''.join(rev_T)
    if T__1 == T__2:
        U = rev_S[0:halfS]
        rev_U = list(reversed(U))
        U__1 = ''.join(U)
        U__2 = ''.join(rev_U)
        if U__1 == U__2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

else:
    print("No")

Submission status: Accepted

Solution code:
# ABC159_B
s=input()
n=len(s)
# if n==1:
#     print('No')
#     exit()

n=n//2
for i in range(int(n//2)+1):
    if s[i]==s[-1-i]:
        pass
    else:
        print('No')
        exit()
f=''
e=''
f=s[:n]
e=s[-n:]
# print(f,e)
for i in range(int(n//2)+1):
    if f[i]==f[-1-i]:
        pass
    else:
        print('No')
        exit()
    if e[i]==e[-i-1]:
        pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
def is_palindrome(s):
    h = len(s) // 2
    if len(s) % 2 == 0:
        if s[:h] == s[:h-1:-1]:
            return True
    else:
        if s[:h] == s[len(s):h:-1]:
            return True

s = input()
if is_palindrome(s) and is_palindrome(s[:(len(s)-1)//2]) and is_palindrome(s[(len(s)+3)//2-1:]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
n = len(S)
def kaibun(S):
    if S == S[::-1]:
        return 1
    else:
        return 0
if kaibun(S) == 0:
    print("No")
else:
    s1 = S[0:n // 2]
    if kaibun(s1) == 1:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
def palindrome(string): return 1 if string==string[::-1] else 0

kaibun=input()

N=len(kaibun)
A=kaibun[0:int((N-1)/2)]
B=kaibun[int((N+3)/2-1):int(N)]


if palindrome(kaibun) & palindrome(A) & palindrome(B):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
str_num = -1
reverse_S = ''

#条件1（Sが回文であるか）
for i in range(-1,-(N+1),-1):
  reverse_S = reverse_S + S[i]

if S == reverse_S:
  condition1 = 'YES'
else:
  condition1 = 'NO'

#条件2
S2 = ''
N2 = int((N-1)/2)
for i in range(N2):
  S2 = S2 + S[i]
  
reverse_S2 = ''
for i in range(-1,-(N2+1),-1):
  reverse_S2 = reverse_S2 + S2[i]

if S2 == reverse_S2:
  condition2 = 'YES'
else:
  condition2 = 'NO'
  
#条件3
S3 = ''
N3 = int((N+3)/2)
for i in range(N3-1,N):
  S3 = S3 + S[i]
  
  
reverse_S3 = ''
for i in range(-1,-(N3-1),-1):
  reverse_S3 = reverse_S3 + S3[i]
  
if S3 == reverse_S3:
  condition3 = 'YES'
else:
  condition3 = 'NO'

if condition1 == condition2 == condition3 == 'YES':
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

ss =s[::-1]

sss =s[1:((n-1)//2)-1]
mmm = sss[::-1]

ssss = s[((n+3)//2)-1:n]
mmmm = ssss[::-1]


if s == ss and sss == mmm and ssss == mmmm:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input()
list_1=list(a)
b=(len(list_1)-1)//2
c=(len(list_1)+3)//2
list_2=list_1[:b]
list_3=list_1[c-1:]
list_1r=list(reversed(list_1))
list_2r=list(reversed(list_2))
list_3r=list(reversed(list_3))
if list_1==list_1r:
  if list_2==list_2r:
    if list_3==list_3r:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys

S = input()


def is_palindrome(s):
    N = len(s)
    if N == 1:
        return True

    half = N // 2
    f = s[:half]
    r = s[-half:][::-1]
    return f == r


if is_palindrome(S) and is_palindrome(S[: len(S) // 2]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
count=0
a=(n-1)//2
b=(n+3)//2
for i in range(n//2):
  if s[i]!=s[-abs(i+1)]:
    count+=1
    
for i in range(a//2):
  c=ord(s[i])
  d=ord(s[(a-1-i)])
  if c!=d:
    count+=1

for i in range((n-b+1)//2):
  c=ord(s[-(i+1)])
  d=ord(s[b-1+i])
  if c!=d:
    count+=1

if count!=0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

def ch_kai(lst):
    new_lst = lst[::-1]
    if lst == new_lst:
        return True
    else:
        return False

if ch_kai(S) and ch_kai(S[0:int((N-1)/2)]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
lenS = len(S)
def isPalin(Si):
    Slen = len(Si)
    firHalf = list(Si[:Slen//2])
    secHalfKai = list(Si[::-1][:Slen//2])
    palin = True
    for i in range(0,Slen//2):
        if firHalf[i] != secHalfKai[i]:
            palin = False
    return palin
good = False
if isPalin(S)==isPalin(S[:int((lenS-1)/2)])==isPalin(S[int((lenS+3)/2)-1:]) == True:
    good = True
if good:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
l = len(S)
import sys
a = S[:(l-1)//2]
b = S[((l+3)//2)-1:l]

for i in range(len(a)//2):
    if str(a[i])==str(a[-i-1]):
        pass
    else:
        print('No')
        sys.exit(0)


for j in range(len(b)//2):

    if b[j]==b[-j-1]:
        pass
    else:
        print('No')
        sys.exit(0)


for k in range(l//2):
    if S[k] == S[-k-1]:
        pass
    else:
        print('No')
        sys.exit(0)

print('Yes')

Submission status: Accepted

Solution code:
s = input()
# sは回文
# n = s.len
# lenの1文字目から(len - 1)/2 までからなる文字列は回文
# sの(len + 3 )/2 から　lenまでからなる文字列は回文

moji1 = s[: int((len(s) - 1) / 2)]
moji2 = s[int((len(s) + 2) / 2): int(len(s))]

moji3 = s[: int((len(s) - 1) / 2)]
moji4 = s[int((len(s) + 2) / 2): int(len(s))]
while int(len(moji1)) > 1:
    a = moji1[0:1]
    b = moji1[-1]
    if a != b:
        print('No')
        exit()
    moji1 = moji1[1:-1]
if (moji3 != moji4):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

N_2 = (N+1) // 2 -1

if (N+1) % 4 == 0:
  N1 = N2 = (N+1) // 4 -1
  N3 = N4 = (N1+1) * 3 -1
else:
  N1 = (N-1) // 4 -1 
  N2 = N1 + 1
  N3 = N_2 + N1 +1
  N4 = N3 + 1
  
#print(N1, N2, N3, N4)
#print(S[0:N1+1], S[N2:N_2], S[N_2+1:N3+1], S[N4:N], S[0:N_2], S[N_2+1:N])

if S[0:N_2] == S[N_2+1:N][::-1] and S[0:N1+1] == S[N2:N_2][::-1] and S[N_2+1:N3+1] == S[N4:N][::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
def ispalindrome(string): return True if string==string[::-1] else False

S1=S[0:(N-1)//2]
S2=S[-1+(N+3)//2:N]

if ispalindrome(S) and ispalindrome(S1) and ispalindrome(S2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = int(len(s))
list = list(s)
lists = list[::-1]
list2 = list[0:(int((n-1)/2))]
list2s = list2[::-1]
list3 = list[int((n + 3)/2)-1:n+1]
list3s = list3[::-1]
count = 0

if list == lists:
    count = count + 1
if list2 == list2s:
    count = count + 1
if list3 == list3s:
    count = count + 1
if count == 3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ppp=S[:(N-1)//2]
qqq=S[(N+1)//2:]

if qqq==qqq[::-1] and ppp==ppp[::-1] and S==S[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
S=str(S)
N=len(S)
N=int(N)
if (3<=N<=99)and(N%2==1):
    c=(N-1)/2
    d=c+1
    c=int(c)
    d=int(d)
    S_1=S[0:c]
    S_2=S[d:]
    i=0
    for i in range(0,c):
        a=N-1-i
        a=int(a)
        b=(N-3)/2-i
        b=int(b)
        if (S[a]==S[i])and(S_1[i]==S_1[b])and(S_2[i]==S_2[b]):
            i+=1
            if i==c:
                print("Yes")
        else:
            print("No")
            break

Submission status: Accepted

Solution code:
def kaibun(strings):
    global flag
    for i in range(len(strings)):
        if strings[i] is not strings[len(strings)-1-i]:
            #print("iは")
            #print(i)
            #print(strings[i])
            #print(strings[len(strings)-1-i])
            flag=1
            #print("flagは1になった")
            #print(flag)
        else:
            pass


S=input()
length=len(S)
S_2=S[0:(length-1)//2]
#print(S_2)
S_3=S[(length+3)//2-1:length]
#print(S_3)

flag=333
#print("flagはいくつ？")
flag=0
#flagが0なら回文である
#なぜかflagが最後に書き換わってしまう。


kaibun(S)
kaibun(S_2)
kaibun(S_3)
#print("呼び出し")

#print(flag)

if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(str(input()))

checker = 0
n = len(s)
new_s = list(reversed(s))
if s == new_s:
    checker += 1


split_s = s[0:(n-1)//2]
new_s = list(reversed(split_s))
if new_s == split_s:
    checker += 1


split_s = s[(n+2)//2:n]
new_s = list(reversed(split_s))
if new_s == split_s:
    checker += 1
if checker == 3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

def solve(string): return True if string == string[::-1] else False

if solve(S) and solve(S[:round((len(S) - 1) / 2)]) and solve(S[round((len(S) + 3) / 2) - 1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = int(len(s))
f = int((n - 1) /2)
th = int((n + 3)/2)
if n % 2 != 0 and 3 <= n <= 99:
    print("Yes") if s[0:f] == s[th-1:] else print("No")

Submission status: Accepted

Solution code:
S = input()
 
def ispalindrome(s):
    h = int(len(s) / 2)
    for a, b in zip(s[:h], reversed(s[h+1:])):
        if a != b: return 0
    return 1
 
index = int((len(S) - 1) / 2)
 
if ispalindrome(S) == 1:
  if ispalindrome(S[:index]) == 1:
    if len(S[:index]) >= 3:
      print("Yes")
    else:
      if len(S[:index]) == 1 and S[0] == S[2]:
        print("Yes")
      else:
        print("No")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
s = input()
def is_palindrome(s):
    return s == s[::-1]

s_len = len(s)
if is_palindrome(s) and is_palindrome(s[:(s_len-1)//2]) and is_palindrome(s[(s_len+3)//2-1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
m = int(n)
d = int((n-1)/2)
e = int((n+3)/2)
a = s[:d]
b = s[e:m]
def yue(l):return 1 if l == l[::-1] else 0
S = yue(s)
A = yue(a)
B = yue(b)
if S + A == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
A = int((N - 1) / 2)
if A % 2 == 0:
  B = int(A / 2)
else:
  B = int((A - 1) / 2)
X = 0
 
for i in range(A):
  if S[i] != S[-i-1]:
    X += 1
 
if N >= 5:
  for i in range(B):
  	if S[i] != S[A-1-i]:
  	    X += 1
      
if X == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 入力
S = input()
# 演算
N = len(S)
if S[0:int((N-1)/2)] == S[int((N+3)/2)-1:N]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from collections import deque

def reverse(p):
    q = p[::-1]
    if p == q:
        return True
    else:
        return False


S = input()

N = len(S)

pt1 = (N - 1) // 2 - 1
pt2 = (N + 3) // 2 - 1

ptS1 = S[:pt1 + 1]
ptS2 = S[pt2:]

#print(ptS1, ptS2)

#print(reverse(ptS1), reverse(ptS2))

if reverse(S) and reverse(ptS1) and reverse(ptS2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def ispalindrome(S,N):
    for a, b in zip(S[:N], reversed(S[:N])):
        if a != b: return 0
    return 1

def ispalindrome2(S,N):
    for a, b in zip(S[N2-1:N], reversed(S[N2-1:N])):
        if a != b: return 0
    return 1

S = input()
N = len(S)
N1 = (N-1)//2
N2 = (N+3)//2

r1 = ispalindrome(S,N)
r2 = ispalindrome(S,N1)
r3 = ispalindrome2(S,N2)
if r1==1 and r2==1 and r3==1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
t = s[::-1]
n = len(s) // 2
ans = False
if s[0:n] == t[0:n]:
	if s[0:n] == s[n+1:n*2+2]:
		ans = True

if ans:
	print('Yes')
else:
	print('No')

Submission status: Accepted

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

a = s[0:int((n-1)/2)]
b = s[int((n+1)/2):n]

if s[::-1] == s and a[::-1] == a and b[::-1] == b:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()

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

n = len(s)
if pal(s) and pal(s[:(n-1)//2]) and pal(s[((n+3)//2) - 1:]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S=input()
N=len(S)
f=0
for i in range((N-1)//4):
    if S[i]!=S[(N-3)//2-i]:
        f=-1
        #print(i)
        break
for i in range((N+1)//2,(3*N+1)//4):
    if S[i]!=S[N-1-i]:
        f=-1
        #print(i)
        break
for i in range((N-1)//2):
    if S[i]!=S[N-1-i]:
        f=-1
        #print(i)
        break
if f==-1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()

#print('S=', S)

n = len(S)

#print('len(S)=', n)

list_S = list(S)

#print('list(S)=', list_S)

count = 0

for i in range((n-1)//2):
  if list_S[i] != list_S[n-1-i]:
    count += 1
if count > 0:
  print('No')
  exit()

list_left = list_S[0 : (n-1)//2]
#print('list_left=', list_left)
list_right = list_S[(n+3)//2-1 : n]
#print('list_right=', list_right)

n_edge = len(list_left)
#print('n_edge=', n_edge)

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

if n_edge % 2 == 0:
  for i in range(n_edge//2):
    if list_left[i] != list_left[n_edge-1-i]:
      print('No')
      exit()


print('Yes')

Submission status: Accepted

Solution code:
S  = input()
N = len(S)
n1,n2 = ((N-1)/2),(N+3)/2
n1,n2 = int(n1),int(n2)
sh,st = S[:n1],S[n2-1:N]

if sh == sh[::-1] and st == st[::-1] and S==S[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input().strip()
l=len(s)
t=s[::-1]
if s!=t:
    print('No')
    exit()
u=s[:l//2]
v=u[::-1]
if u!=v:
    print('No')
    exit()
u=s[(l+1)//2:]
v=u[::-1]
if u!=v:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
s2 = (len(s)-1) // 2
s3 = (len(s)+3) // 2
if s != s[::-1]:
    print("No")
else:
    if s[0:s2] != ''.join(list(reversed(s[0:s2]))):
        print("No")
    else:
        if s[s3-1::] != ''.join(list(reversed(s[s3-1::]))):
            print("No")
        else:
            print("Yes")

Submission status: Accepted

Solution code:
ans = "Yes"
s = input()
if s != s[::-1]: # スライスというやつ 全体が回文かどうか
  ans = "No"
n = len(s) // 2
if s[:n] != s[n-1::-1]: # 全体が回文は保証されているので片方だけ判定
  ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

# if (n//2) % 2 == 0:
#     print("No")
#     exit()

t = 0
for i in range(n//2):
    if s[i] != s[-i-1]:
        print("No")
        exit()

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

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

print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	S = input()
	S = S[:-1]

	if kai(S) == True:
		tmp = len(S)
		tmp = (tmp -1) // 2
		if kai(S[:tmp]) == True:
			tmp = len(S)
			tmp = (tmp +3) // 2
			#print(S[tmp-1:])
			if kai(S[tmp-1:]) == True:

				print("Yes")
				sys.exit()
	print("No")


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# special thanks :
#  https://nagiss.hateblo.jp/entry/2019/07/01/185421
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
def kai(s):
	flg = True
	tmp = len(s)
	tmp = tmp //2

	for i in range(tmp):
		ii = (-1 * i) + -1
		if s[i] != s[ii]:
			flg = False
	return flg

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))

# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
text = str(input())
n = len(text)
target = (n-1)//2
 
bef = text[:target]
aft = text[target+1:]
 
if bef == aft:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:

def reverse(s): 
    return s[::-1] 
  
def isPalindrome(s): 
    
    rev = reverse(s) 
  
    if (s == rev): 
        return True
    return False
def listToString(s):  

    str1 = ""  
    for ele in s:  
        str1 += ele   
   
    return str1   
    
s=input()
n = len(s)
p=int(round((n-1)/2))
q=int(round((n+3)/2))
ans = isPalindrome(s)


t1=[]
t2=[]

for i in range(0,p):
    t1.append(s[i])
for i in range(q-1,n):
    t2.append(s[i])    

ans1=isPalindrome(listToString(t1))
ans2=isPalindrome(listToString(t2))
if (ans==1 and ans1==1 and ans2==1):
    print ("Yes")
    
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
L=len(S)
count=0
for i in range(L//2):
	if S[i] == S[-i-1]:
		count+=1
	else:
		print("No")
		exit()

Sa=S[:(L-1)//2]
Sb=S[(L+3)//2-1:(L+1)]
La=len(Sa)
Lb=len(Sb)

for j in range(La//2):
	if Sa[j] == Sa[-j-1]:
		count+=1
	else:
		print("No")
		exit()
        
for k in range(Lb//2):
	if Sb[k] == Sb[-k-1]:
		count+=1
	else:
		print("No")
		exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
S1=S[0:int((N-1)/2)]
S2=S[int((N+3)/2)-1:len(S)]
if S==S[::-1] and S1==S1[::-1] and S1==S1[::-1]:
  print("Yes")
else :
  print("No")

Submission status: Accepted

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

def is_kaibun(s):
    n = len(s)
    head = s[:(n - (n % 2)) // 2]
    tail = s[(n+(n%2)) // 2:]
    #print("head = {} tail = {}".format(head, tail[::-1]))
    return head == tail[::-1]

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

Submission status: Accepted

Solution code:
S = input()
len = len(S)
flag = 0
for num in range((len-1)//2):
    if flag == 0:
        if S[num] != S[len-1-num]:
            print("No")
            flag = 1
        elif S[num] != S[((len-1)//2)-1-num]:
            print("No")
            flag = 1
if flag == 0:
    print("Yes")

Submission status: Accepted

Solution code:
s = list(input())
N = int(len(s))
a = int(((N-1)/2))
b = int(((N+3)/2))
s1 = s[0:a]
s2 = s[b:N-1]
if s1 == list(reversed(s1)) and s2 ==list(reversed(s2)) and s ==list(reversed(s)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=str(input())

N=len(S)

if((N+1)%4 == 0):
    k=(N-1)//4+1
else:
    k=(N-1)//4

for i in range(0, (N-1)//4+1):
    if(S[i] == S[(N-1)//2-i-1] == S[i+(N+1)//2] == S[N-i-1]):
        if i == k-1:
            print("Yes")
            break;
        else:
            continue
    else:
        print("No")
        break;

Submission status: Accepted

Solution code:
from collections import deque
S = input()
N = len(S) 
s1 = deque(S[0:int((N-1)/2)])
s2 = deque(S[int((N+3)/2)-1:N])
t1 = deque(S[0:int((N-1)/2)])
t2 = deque(S[int((N+3)/2)-1:N])
ans = "None"
if len(S) == 3 and S[0] == S[2]:
    ans = "Yes"
while len(s1) >= 2:
    if s1.popleft() != s2.pop():
        ans = "No"
        break
    if len(s1) == 1 or len(s1) == 0:
        ans = "preYes"
        break

if ans == "preYes":
    while len(t1) >= 2:
        if t1.pop() != t1.popleft():
            ans = "No"
            break
        if len(t1) == 1 or len(t1) == 0:
            ans = "Yes"
            break
print(ans)

Submission status: Accepted

Solution code:
S = input()
S_len = len(S)
#print(S_len)
S_left = S[0:int(S_len/2)]
S_right = S[int(S_len/2)+1:]
def palindrome(string): return 0 if string==string[::-1] else 1

if(palindrome(S)== 0 and palindrome(S_left) == 0 and palindrome(S_right) == 0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

N2 = len(a)
c = a[::-1]
d = b[::-1]
#print(a, b)

if N2 % 2 == 0:
    # print(a[0:N2 // 2])
    # print(c[0:N2 // 2])
    # print(b[0:N2 // 2])
    # print(d[0:N2 // 2])
    if a[0:N2//2] == c[0:N2//2] and b[0:N2//2] == d[0:N2//2]:
        print('Yes')
    else:
        print('No')

if N2 % 2 == 1:
    # print(a[0:(N2 + 1) // 2])
    # print(c[0:(N2 + 1) // 2])
    # print(b[0:(N2 + 1) // 2])
    # print(d[0:(N2 + 1) // 2])
    if a[0:(N2+1)//2] == c[0:(N2+1)//2] and b[0:(N2+1)//2] == d[0:(N2+1)//2]:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
char = str(input())
length = len(char)
char_len = ((length-1)/2)
char_list = list(char)
cnt = 0
list1 = []
list2 = []
newlist = []

while cnt != char_len:
    list1.append(char_list[cnt])
    cnt += 1

cnt2 = ((char_len * -1)-1)
cnt3 = -1
while cnt3 != cnt2:
    list2.append(char_list[cnt3])
    cnt3 -= 1

if list1 != list2:
    print('No')
else:
    for i in (reversed(list1)):
        newlist.append(i)
    if newlist == list1:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:

s = input()
n = len(s)

flag = True
# 回分チェック
if not s[:int(n/2)] == s[int(n/2)+1:][::-1]:
    flag = False

# 2チェック
chk = s[:int((n-1)/2)]
len_ = len(chk)
if not len_ % 2 == 0:
    a = chk[:int(len_/2)]
    b = chk[int(len_/2)+1:]
else:
    a = chk[:int(len_/2)]
    b = chk[int(len_/2):]
len_ = len(chk)
if not a == b[::-1]:
    flag = False
# 3チェック
chk = s[int((n+3)/2)-1:]

len_ = len(chk)
if not len_ % 2 == 0:
    a = chk[:int(len_/2)]
    b = chk[int(len_/2)+1:]
else:
    a = chk[:int(len_/2)]
    b = chk[int(len_/2):]

len_ = len(chk)
if not a == b[::-1]:
    flag = False
if flag:
    print('Yes')
else:
    print('No')

#kkkkkkkkkkdkkkkkkkkkk
#21
#abcdeefghiAihgfeedcba

Submission status: Accepted

Solution code:
s = input()

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

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

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

Submission status: Accepted

Solution code:
s = str(input())
s_len = len(s)
def palindrome(string):
    if string==string[::-1]:
        return 1

    else:
        return 0

nn = (s_len - 1) // 2
# print(nn)
# print(s[0:nn])
mm = (s_len + 3) // 2 - 1
# print(s[mm:])

if palindrome(s) == 1 and palindrome(s[0:nn]) and palindrome(s[mm:]):
    # print("c")
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
mr = s[::-1]
n = len(s)
f = 1

if s == mr:
  pass
else:
  f = 0
  
# ------------------------------

s2 = s[:((n-1)//2)]
mr = s2[::-1]

if s2 == mr:
  pass
else:
  f = 0


# ------------------------------
  
s3 = s[((n+3)//2)-1:]
mr = s3[::-1]

if s3 == mr:
  pass
else:
  f = 0
  
if f == 1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import math

def loop(string,length):
	first_str=string[0:length//2]
	if (length%2)==0:
		second_str=string[length//2:length]
	if (length%2)==1:
		second_str=string[length//2+1:length]
	second_str=second_str[::-1]
	if(first_str==second_str):
		return 1
	else:
		return 0

S=input()
N=len(S)
Astr=S[0:((N-1)//2)]
Bstr=S[((N+3)//2-1):N]

if(loop(S,N)==1) and loop(Astr,len(Astr))==1 and (loop(Bstr,len(Bstr))==1):
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
import math

s = input()
list = list(s)


num = math.floor(len(s)/2)
count = 0


if len(s) == 3:
    if list[0] == list[2]:
        print("Yes")
    else:
        print("No")


else:
    
    for i in range(num):
        if list[i] == list[num+1+i]:
            count += 1
        else:
            print("No")
            break

if len(s) == 3:
    None
else:
    if count == num:
        print("Yes")
    else:
        None

Submission status: Accepted

Solution code:
inp = input()
rev = inp[::-1]
num = len(inp)
harf = int(num/2)

start = inp[0:harf - 1]
end = rev[0:harf - 1]
ans = 0

if (inp == rev):
    lis_11 = inp[0:harf]
    lis_12 = rev[harf + 1:]

    if (lis_11 == lis_12):
        lis_21 = inp[harf + 1:]
        lis_22 = rev[0:harf]
        if (lis_21 == lis_22):
            ans += 1
if (ans == 1):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from math import ceil
def kaibun(moji):
    N = len(moji)
    n = 0
    for i in range(int((N+1)//2)):
        if moji[i] == moji[N-i-1]:
            n += 1
    if n == int((N+1)//2) :
        return 1
    else:
        return 0

S = input()
N = len(S)
mae = S[:ceil((N-1)/2)]
ato = S[-ceil((N-1)/2):]
if kaibun(S) == 0:
    print("No")
elif kaibun(mae) == 1 and kaibun(ato) == 1:
    print("Yes")
else :
    print("No")