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()
n = len(s)
sss = "No"

if s[0:n//2] == s[n//2+1:n][::-1]:
    r = n//2
    le = r//2
    if s[0:le] == s[r-le:r][::-1]:
        if s[r+1:r+1+le] == s[n-le:n][::-1]:
            sss = "Yes"
            
print(sss)

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+1)//2:]==s[(n+1)//2:][::-1]:

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = input()

s_len = len(s)

pre_half_str = s[0:int((s_len-1)/2)]
latter_half_str = s[int((s_len+2)/2):]

if "".join(reversed(s)) == s:
    if "".join(reversed(pre_half_str)) == pre_half_str:
        if "".join((reversed(latter_half_str))) == latter_half_str:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

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

if __name__ == '__main__':
    s = input()
    if check(s):
        if check(s[0:len(s)//2]):
            if check(s[(len(s)//2)+1:len(s)]):
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
S = input()

flg = True

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

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

hajime = ((len(S)-1+3) // 2)
for i in range(hajime, len(S)):
    if S[i] != S[end-i]:
        flg = False

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

    s1 = S
    s2 = S[:N // 2:1]
    s3 = S[(N + 3) // 2 - 1::1]

    if all([s1[::1] == s1[::-1],
            s2[::1] == s2[::-1],
            s3[::1] == s3[::-1]]):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=input()
N2=N[::-1]

m1=int((len(N)-1)/2)
m3=int((len(N)+1)/2)

N3=N[:m1]
N4=N3[::-1]

N5=N[m3:]
N6=N5[::-1]

if N==N2 and N3==N4 and N5==N6:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
sre = "".join(list(reversed(s)))
n = len(s)

s1 = s[0:int((n-1)/2)]
s1re = "".join(list(reversed(s1)))
s2 = s[int((n+3)/2)-1:]
s2re = "".join(list(reversed(s2)))
if s1 == s1re and s2 == s2re and s == sre:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
chk = True
a = s[:((n-1)//2)]
b = s[((n+1)//2):]
if(s[::]!=s[::-1]):chk=False
if a[::]!=a[::-1]:chk=False
if b[::]!=b[::-1]:chk=False
if(chk):print("Yes")
else:print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

N = len(S)

ans = True
for i in range(N//2):
    if S[i] == S[-1-i]:
        pass
    else:
        ans = False
        
M = (N-1)//2
S2 = S[:M]
L = (N+3)//2
S3 = S[L-1:]

for i in range(len(S2)//2):
    if S2[i] == S2[-1-i]:
        pass
    else:
        ans = False
for i in range(len(S3)//2):
    if S3[i] == S3[-1-i]:
        pass
    else:
        ans = False
        


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

Submission status: Accepted

Solution code:
a=input()
b=list(a)
c=0
for i in range(len(b)):
    if b[i]!=b[(len(b)-1-i)]:
        c=1
for i in range(int(len(b)/2)):
    if b[i]!=b[int(((len(b)-1)/2))-1-i]:
        c=1

if c==1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=input()

n=len(S)
for i in range(n):
  if S[i]!=S[-(i+1)]:
    print('No')
    exit()
    
s1,s2=S[:(n-1)//2],S[(n+3)//2-1:]
lim=(n-1)//2
for i in range(lim):
  if s1[i]!=s1[-(i+1)] or s2[i]!=s2[-(i+1)]:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

p_s = s[:((n+1) // 2 )-1]
s_s = s[((n+3) // 2) - 1:]

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

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def kaibunn(s):
    n = len(s)
    m = n // 2
    res = True
    for i in range(m):
        if s[i] != s[n-1-i]:
            res = False
            break
    return res


def main():
    S = input().rstrip()

    N = len(S)

    isKaibunn = kaibunn(S)

    if isKaibunn:
        T = S[0:(N-1)//2]
        isKaibunn = kaibunn(T)
        if isKaibunn:
            T = S[(N+3)//2-1:N]
            isKaibunn = kaibunn(T)

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


main()

Submission status: Accepted

Solution code:
S = input()
n = len(S)
if n%2 == 0:
    print("No")
    exit()
else:
    for i in range(n//2):
        if S[i] != S[(n-1)-i]:
            print("No")
            exit()
    for i in range(((n-1)//2)//2):
        if S[i] != S[(((n-1)//2)-1)-i]:
            print("No")
            exit()
    for i in range((n//2)+1,(n//2)+1+(n-(n//2)+1)//2):
        if S[i] != S[(n-1)-i]:
            print("No")
            exit()
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
def checker(s):
  for i in range(len(s)//2):
    if s[i] != s[-(i+1)]:
      return False
  return True
if checker(s) == True and checker(s[(len(s)+3)//2-1:]):
  print('Yes')
  exit()
print('No')

Submission status: Accepted

Solution code:
s = list(input())
def solve(now, flg):
  for i in range(len(now)//2):
    if now[i] != now[(i+1)*(-1)]:
      flg += 1
      break
  return flg

flg = 0
now = s
flg = solve(now, flg)
now = s[:(s.__len__()-1)//2]
flg = solve(now, flg)
now = s[(s.__len__()+3)//2-1:]
flg = solve(now, flg)
print("Yes" if flg == 0 else "No")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

if l[:(n//2)]==l[:(n//2)][::-1] and l == l[::-1] and l[(n//2+1):]==l[(n//2+1):][::-1]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

    kaibun_check(S)

    S1 = S[0:(N-1)//2]
    kaibun_check(S1)

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

    print('Yes')


def kaibun_check(L):
    L_ = list(L.__reversed__())
    for s, s_ in zip(L, L_):
        if s != s_:
            print('No')
            exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ln2 = s[0:(len(s) - 1)//2]
ln3 = s[(len(s) + 3)//2 - 1:len(s)]

r_s = s[::-1]
r_ln2 = ln2[::-1]
r_ln3 = ln3[::-1]
if s == r_s and ln2 == r_ln2 and ln3 == r_ln3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
if list(reversed(S)) == list(S) and list(reversed(S[:(N-1)//2])) == list(S[:(N-1)//2]) and list(reversed(S[((N+3)//2)-1:])) == list(S[((N+3)//2)-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+3)//2-1:n]
S = []
S1 = []
S2 = []
i = -1
j = -1
k = -1
while i >= n * -1:
    S.append(s[i])
 
    i -= 1
while j >= len(s1) * -1:
    S1.append(s1[j])
    j -= 1
while k >= len(s2) * -1:
    S2.append(s2[k])
    k -= 1
if s == S and s1 == S1 and s2 == S2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
ans = sum([i==i[::-1] for i in [S,S[:(N-1)//2], S[(N+3)//2-1:]]])
print("Yes" if ans==3 else "No")

Submission status: Accepted

Solution code:
import math

def check_kai(arr):
    len_a = len(arr)
    check_len = int(math.ceil(len_a/2))
    lef = arr[0:check_len]
    arr.reverse()
    rig = arr[0:check_len]
    if lef == rig:
        return True
    else:
        return False


input = list(input())
N = len(input)

if check_kai(input) and check_kai(input[0:(int((N-1)/2))]) and check_kai(input[int((N+1)/2):]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
#s
s=[]
s=input()

i=0
nagasa=len(s)

while i <= (len(s)/2):
    if s[i] != s[len(s)-1-i]:
        print("No")
        sys.exit()
    i+=1

i=0
len2 = int(len(s)/2 -1)
while i <= len2/2:
    if s[i] != s[len2-i]:
        print("No")
        sys.exit()
    i+=1

i=(len(s)+3)/2
j=0
while i <= len(s)/2:
    if s[i] != s[len(s)-j]:
        print("No")
        sys.exit()
    i+=1
    j+=1

print("Yes")

Submission status: Accepted

Solution code:
S = input()

Flag = True
# Lは奇数
N = len(S)

for i in range(N//2):
    if S[i] != S[-(i+1)]:
        Flag = False

for j in range( (N-1)//2 ):
    if S[j] != S[(N-1)//2 - 1 - j]:
        Flag = False

for k in range( (N+3)//2 -1 , N ):
    if S[k] != S[-(k+1)]:
        Flag = False

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

Submission status: Accepted

Solution code:
import sys 

S = input()

n = len(S)

l = 0
r = n
while l < r:
    #print(S[l], S[r-1])
    if S[l] != S[r-1]:
        print('No')
        sys.exit()
    l += 1
    r -= 1

ls = S[:((n-1)//2)]
#print(ls)
l = 0
r = len(ls)
while l < r:
    #print(S[l], S[r-1])
    if ls[l] != ls[r-1]:
        print('No')
        sys.exit()
    l += 1
    r -= 1

rs = S[((n+3)//2)-1:]
#print(rs)
l = 0
r = len(rs)
while l < r:
    #print(rs[l], rs[r-1])
    if rs[l] != rs[r-1]:
        print('No')
        sys.exit()
    l += 1
    r -= 1

print('Yes')

Submission status: Accepted

Solution code:
import math
import sys


scan = sys.stdin.readline


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


def main():
    s = scan().rstrip()  # type: str

    if not is_palindrome(s):
        print("No")
        return

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


for i in range(int((N-1)/2)):
  if S1[i] != S1[len(S1)-i-1]:
    flag = 0
  if S2[i] != S2[len(S2)-i-1]:
    flag = 0
  if S[i] != S[len(S)-i-1]:
    flag = 0
    
if flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S = input().rstrip()
N = len(S)
for i in range((N - 1) // 2):
    if S[i] != S[N-1-i]:
        print("No")
        exit(0)
s = S[:(N-1) // 2]
n = len(s)
if n == 2 and s[0] != s[1]:
    print("No")
    exit(0)

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

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
ni = int((n-1)/2)
np = int((n+1)/2)
si = s[0:ni]
sp = s[np:]
if s == s[::-1]:
  if si == si[::-1]:
    if sp == sp[::-1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())
len_s = len(S)
right = S[0:(len_s-1)//2]
left = S[(len_s+3)//2-1:]
if S != list(reversed(S)):
    print("No")
elif right != list(reversed(right)):
    print("No")
elif left != list(reversed(left)):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
k = list(input())
l = len(k)
if ''.join(k) == ''.join(reversed(k)):
  if ''.join(k[0:int(l//2)]) == ''.join(reversed(k[0:int(l//2)])) and ''.join(k[int(l//2) + 1 : l]) == ''.join(reversed(k[int(l//2) + 1 : l])):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
n1=((n-1)//2)
n2=(n+3)//2
s1=s[0:n1]
s2=s[n2-1:]
if s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
r = ''.join(list(reversed(s)))

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

Submission status: Accepted

Solution code:
s = [i for i in input()]
s1, s2 = s[:(len(s)-1)//2], s[(len(s)+3)//2-1:]
for i in range(len(s1)//2):
    if s1[i] != s1[-i-1] or s2[i] != s2[-i-1]:
        print("No")
        exit()
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

check_a = True
N = len(S)
for i in range(int((N-1)/2)):
    if not S[i] == S[N-1-i]:
        check_a = False

check_b = True
for i in range(int((N-1)/4)):
    if not S[i] == S[int((N-1)/2)-1-i]:
        check_b = False

if check_a and check_b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys


def LI():
    return list(map(int, sys.stdin.buffer.readline().split()))


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]

# ----------------------------------------------------------------


def main():
    s = S()

    n = len(s)
    a1 = int((n - 1) / 2)
    a2 = int((n + 3) / 2 - 1)
    pow1 = s[:a1]
    pow2 = s[a2:]

    if s == s[::-1] and pow1 == pow1[::-1] and pow2 == pow2[::-1]:
        print("Yes")

    else:
        print("No")


main()

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S) // 2):
  if S[i] != S[-1 + i * -1]:
    print('No')
    exit()

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

for i in range(len(S) // 2 + 1, len(S) // 2 + 1 + len(S)// 2 //2):
  if S[i] != S[-1 + i * -1]:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
flag=True
for i in range((n-1)//2):
  if s[i]!=s[(-1)*(i+1)]:
    #print("g1",i)
    flag=False
    break
if flag:
  for i in range((n-1)//4):
    if s[i]!=s[(n-1)//2-(i+1)] or s[(n+3)//2-1+i]!=s[(-1)*(i+1)]:
      #print("g2",i)
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

t1 = 0
t2 = 0
t3 = 0

for i in range(int(N/2)):
    if S[i] != S[-i-1]:
        break
else:
    t1 = 1
        
S2 = S[0:int((N-1)/2)]
N2 = len(S2)
for i in range(int(N2/2)):
    if S2[i] != S2[-i-1]:
        break
else:
    t2 = 1
    
S3 = S[int((N+3)/2)-1:N]
N3 = len(S3)
for i in range(int(N3/2)):
    if S[i] != S[-i-1]:
        break
else:
    t3 = 1
    
if t1 == t2 == t3 == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
flag = False
for i in range(l//2):
    if s[i] != s[-(i+1)]:
        flag = True
for i in range(int((l-1)/2)):
    if s[i] != s[int((l-1)/2)-i+1] and s[int((l+3)/2)+i-1] != s[-(i+1)]:
        flag = True
print('No' if flag else 'Yes')

Submission status: Accepted

Solution code:
s = input()

n = len(s)
s_h = s[:(n-1)//2]
s_f = s[(n+2)//2:]

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

Submission status: Accepted

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

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

sub1 = S[0:(N-1)//2]
sub2 = S[(N+3)//2-1:N]

if checkPalindrome(S) and checkPalindrome(sub1) and checkPalindrome(sub2):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S=input()
N=len(S)
def check(S):
  return S[:]==S[::-1]

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

Submission status: Accepted

Solution code:
input_line = list(input())
half = (len(input_line) - 1) // 2
before = "".join(input_line[0: half])
after = "".join(input_line[half + 1: len(input_line)])
input_line = "".join(input_line)
input_line_reverse = "".join(list(reversed(input_line)))
before_reverse = "".join(list(reversed(before)))
after_reverse = "".join(list(reversed(after)))

if input_line == input_line_reverse and before == before_reverse and after == after_reverse:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()

n=int((len(s)-1)*0.5)
ans="Yes"
for i in range(n):
  if (s[i]==s[n-1-i]) & (s[n+1+i]==s[n*2-i]) & (s[i]==s[n*2-i]):
    continue
  else:
    ans="No"
    break

print(ans)

Submission status: Accepted

Solution code:
s1 = input()

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

s2 = s1[0:int((len(s1)-1)/2)]
s3 = s1[int((len(s1)+3)/2) -1:len(s1)]

if is_kaibun(s1) == True and is_kaibun(s2) == True and is_kaibun(s3) == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def isR(st):
    f=True
    for x in range(len(st)):
        if st[x]!=st[-x-1]:f=False
    return f

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

Submission status: Accepted

Solution code:
inputstring = input()
firststring = list()
secondstring = list()
count = 0
if len(inputstring) % 2 != 0:
    lenfirst = int((len(inputstring) - 1) / 2)
    for i in range (0, lenfirst):
        firststring.append(inputstring[i])
    lensecond = int((len(inputstring) + 3) / 2)
    lensecond = lensecond - 1
    for i in range (lensecond, len(inputstring)):
        secondstring.append(inputstring[i])
    for i in range (0, lenfirst):
        if firststring[i] == secondstring[i]:
            count = count + 1
        else:
            count = 0
    if count == lenfirst:
        print("Yes")
    else:
        print("No")
else:
    print()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

    n = len(s)
    left = s[:(n-1)//2]
    right = s[(n+1)//2:]

    if left == right:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

s = list(input())
N = len(s)
res = True


for i in range((N - 1) // 2):
    if s[i] != s[N - i - 1]:
        res = False

N = (N - 1) // 2

if N % 2 != 0:
    for i in range((N - 1) // 2):
        if s[i] != s[N - i - 1]:
            res = False
        if s[i + N + 1] != s[N - i - 1 + N + 1]:
            res = False
else:
    for i in range(N // 2):
        if s[i] != s[N - i - 1]:
            res = False
        if s[i + N + 1] != s[N - i - 1 + N + 1]:
            res = False

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

Submission status: Accepted

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

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy

#import numpy as np
s=input().strip()
n=len(s)
f=True
for i in range(n//2):
    if s[i]==s[-i-1]:
        if s[i//4]==s[(-i-1)//4-(len(s)//2+1)]:
            if s[len(s)//2+1+i//4]==s[(-i-1)//4]:
                continue
            else:
                f=False
        else:
            f=False
    else:
        f=False
if f:
    print("Yes")
else:
    print("No")
#l=int(input())

Submission status: Accepted

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

if is_kaibun(S):
  if is_kaibun(S[0:(N - 1)//2]):
    if is_kaibun(S[(N + 3)//2 - 1:]):
      print('Yes')
      exit()
print('No')

Submission status: Accepted

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

b= ''.join(list(reversed(S)))
k=0
if S==''.join(list(reversed(S))):
    S1=S[:(N-1)//2]
    if S1==''.join(list(reversed(S1))):
        S2=S[(N+3)//2-1:]
        if S2==''.join(list(reversed(S2))):
            print("Yes")
            k=1
if k==0:
    print("No")

Submission status: Accepted

Solution code:
import math
def j(s):
    n = len(s)
    if s[:n//2]==s[math.ceil(n/2):][::-1]:
        return True
    else:
        return False


s = input()
n = len(s)

if not j(s):
    print("No")
    exit()
if not j(s[:n//2]):
    print("No")
    exit()
if not j(s[n//2+1:]):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

S = str(input())

N = len(S)

#条件１
T = S[:(N-1)//2]
t = T[::-1]

#条件2
U = S[(N+3)//2-1:]
u = U[::-1]

#反転した文字
s = S[::-1]

#必要なかった！！！
ans = 'No'

if S != s:
    ans = 'No'

else:
    if T == t and U == u:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
S = str(input())
ans = "Yes"
if S != S[::-1]:
    ans = "No"
elif S[:int((len(S)-1)/2)] != S[:int((len(S)-1)/2)][::-1]:
    ans = "No"
elif S[int((len(S)+3)/2)-1:] != S[int((len(S)+3)/2)-1:][::-1]:
    ans = "No"
else:
    pass
print(ans)

Submission status: Accepted

Solution code:
s=raw_input()
flag=0
s1=s[::-1]
# print s1
if s1!=s:
  print "No"
  exit(0)
s1=s[0:(len(s)-1)/2]
s2=s1[::-1]
# print s1
if s1!=s2:
  print "No"
  exit(0)

print "Yes"

Submission status: Accepted

Solution code:
S = input()
S_front = [""] * (len(S)//2)
S_end = [""] * (len(S)//2)

def check(S):
 for i in range(len(S)//2):
    if S[i] != S[len(S) - i - 1]:
        print("No")
        exit()

for i in range(len(S)//2):
    S_front[i] = S[i]
    S_end[i] = S[len(S) - i - 1]
    if S[i] != S[len(S) - i - 1]:
        print("No")
        exit()

check(S_front)
check(S_end)

print("Yes")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
N1 = int( (N+1) / 2 )

S1 = S[0:N1-1]
S2 = S[-N1+1:]
S1_r = S1[::-1]

if S1==S2 and S1 == S1_r:
    print("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
def palindrome(_string): return _string.find(_string[::-1])

def main():
    s = input()
    length = len(s)
    if palindrome(s) == 0 and palindrome(s[0:int((length - 1)/2)]) == 0 and palindrome(s[int((length + 3)/2 - 1):]) == 0:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def ispalindrome(s): return True if s == s[::-1] else False

s = input()

ans = "No"

upper_s = s[:int((len(s)-1)/2)]
lower_s = s[int((len(s)+3)/2)-1:]

if ispalindrome(s) and ispalindrome(upper_s) and ispalindrome(lower_s):
    ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
S = input()
rS = S[::-1]
n = len(S)
sS = S[:int(n/2):]
rsS = sS[::-1]
SS = S[int(n/2)+1::]
rSS = SS[::-1]
kaibun1 = (S == rS)
kaibun2 = (sS == rsS)
kaibun3 = (SS == rSS)

print('Yes' if kaibun1 and kaibun2 and kaibun3 else 'No')

Submission status: Accepted

Solution code:
def is_palindrome(s):
    # str(reversed(s))
    return s == s[::-1]

S = input().strip()
N = len(S)
Sl = S[:(N-1)//2]
Sr = S[(N+1)//2:]
# print(Sl, Sr)
print('Yes' if is_palindrome(S) and is_palindrome(Sl) and is_palindrome(Sr) else 'No')

Submission status: Accepted

Solution code:
s = input()
rs = "".join(list(reversed(s)))

if s != rs:
    print("No")
    quit()

n = len(s)
lefts = s[:(n-1)//2]
rlefts = "".join(reversed(lefts))

if lefts != rlefts:
    print("No")
    quit()

rights = s[(n-1)//2+1:]
rrights = "".join(reversed(rights))

if rights != rrights:
    print("No")
    quit()

print("Yes")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes" 
NO = "No"

S = input()

R = S[::-1]

if S != R:
    print(NO)
    sys.exit()

N = len(S)
P = (N-1)//2
A = S[1::P+1]
rA = A[::-1]

if A != rA:
    print(NO)
    sys.exit()

M = (N+3)//2
Q = S[M::N+1]
rQ = Q[::-1]

if Q != rQ:
    print(NO)
    sys.exit()

print(YES)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
sf = s[0:(n-1)//2]
sl = s[(n+1)//2:]
for i in range(n//2):
    if s[i] != s[-i-1]:
        print('No')
        exit()
n2 = len(sf)
for i in range(n2//2):
    if sf[i] != sf[-i-1] or sl[i] != sl[-i-1]:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

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

def main():
    s = input()
    n = len(s)
    #print(s[0:(n-1)//2+1])
    #print(s[(n+3)//2:n+1])
    kaibun = is_kaibun(s) and is_kaibun(s[0:(n-1)//2]) and is_kaibun(s[(n+3)//2-1:n+1])
    print("Yes" if kaibun else "No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

def check(s):
  return s==s[::-1]

if check(S) and check(S[:int((len(S)-1)/2)]) and check(S[int((len(S)+3)/2-1):]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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



S=input()
if is_kaibun(S):
    print('No')
    exit()
N=len(S)
N2=(N-1)/2
S2 = S[:int(N2)]
if is_kaibun(S2):
    print('No')
    exit()
N3=(N+3)/2
S3 = S[int(N3)-1:]
if is_kaibun(S3):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input().rstrip("")
N = len(S)

O = S[:int((N-1)/2)]
P = S[int((N+3)/2)-1:]


if  N % 2 == 0:
    print("No")

else:
    if S == S[::-1]:
        if O == O[::-1]:
            if P == P[::-1]:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

S_list = list(S)
reversed_S = list(reversed(S_list))

kore = S_list[0:int((N-1)/2-1)+1]
sore = list(reversed(kore))

dore = S_list[int((N+3)/2-1):int(N-1)+1]
kusa = list(reversed(dore))

if S_list == reversed_S and kore == sore and kore == kusa:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math

def isPalindrome(s):
    n = len(s)
    flag = True
    for i in range(n):
        if i < math.floor(n/2):
            if s[i] == s[n - i - 1]:
                continue
            else:
                flag = False
    return flag


s = str(input())
n = len(s)
if n < 3:
    print('No')
medium = math.floor(n/2)
if isPalindrome(s) and isPalindrome(s[0:medium]) and isPalindrome(s[medium+1:n]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s_left = s[:int((len(s)-1)/2)]
s_right = s[int((len(s)+3)/2)-1:]
if s == s[::-1] and s_left == s_left[::-1] and s_right == s_right[::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
flg = True
s4 = reversed(s)
if s != s[::-1]:
    flg = False
s2 = s[0:((n-1)//2)]
s5 = reversed(s)
if s2 != s2[::-1]:
    flg = False
s3 = s[(n+3)//2 -1:n]
s6 = reversed(s)
if s3 != s3[::-1]:
    flg = False
if flg == True:
    print('Yes')
else:
    print('No')
#print(s[::-1])

Submission status: Accepted

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

Srev = "".join(list(reversed(S)))

if S != Srev:
  print('No')
  exit()

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

S2 = S[(N+3)//2 - 1:N]
S2rev = "".join(list(reversed(S2)))

if S2 != S2rev:
  print('No')
  exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()
rs = s[::-1]

# 回文チェック
for i in range(len(s)):
    if s[i] != rs[i]:
        print('No')
        exit(0)

# 前半の回文チェック
zs = s[:len(s)//2]
rzs = zs[::-1]
for i in range(len(zs)):
    if zs[i] != rzs[i]:
        print('No')
        exit(0)

# 後半の回文チェック
ks = s[len(s)//2+1:]
rks = ks[::-1]
for i in range(len(ks)):
    if ks[i] != rks[i]:
        print('No')
        exit(0)

print('Yes')

Submission status: Accepted

Solution code:
S = input()
N=len(S) # 奇数
S1 = S[0:(N-1)//2]
S2 = S[(N+3)//2-1:]
S1_inv = S1[::-1]
S2_inv = S2[::-1]
S_inv = S[::-1]
if S1 == S1_inv and S2 == S2_inv and S==S_inv:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
ok = s == s[::-1]
n = len(s)
if s[:n//2] != s[n//2-1::-1]:
    ok = False
if s[n//2+1:] != s[:n//2:-1]:
    ok = False
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

s0 = s[::-1]

if s1 == s2 and s3 == s4 and s == s0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def kaibun(a):
    l = len(a)
    aa = a.copy()
    aa.reverse()
    D = True
    for i in range(l//2):
        if a[i] != aa[i]:
            D = False
            break
    return D



S = list(input())

ans = "No"

if (kaibun(S)) & (kaibun(S[:len(S)//2])) & (kaibun(S[(len(S) + 1)//2:])):
    ans = "Yes"

print(ans)

Submission status: Accepted

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

print(ans)