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)
for i in range(int((n-1)*0.5)):
    if s[i] != s[int((n-3)*0.5) - i] or s[i] != s[n-1 - i] or s[i] != s[int((n+1)*0.5) + i]:
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = 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:] == s[n-1:(n+3)//2-2:-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
c=list(reversed(s))
n=len(s)
t=list(s[:int((n-1)/2)])
a=list(reversed(t))
u=list(s[int((n+3)/2)-1:])
b=list(reversed(u))
#print(b)
if t==a and u==b and s==c:
    print("Yes")   
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    I=lambda:input()
    s=I()
    if s!=s[::-1]:
        print('No')
        exit()
    s1=s[:(len(s)-1//2)+1]
    if s1!=s1[::-1]:
        print('No')
        exit()
    s2=s[(len(s)+3)//2-1:]
    if s2!=s2[::-1]:
        print('No')
        exit()
    print('Yes')
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

s_rev=s[::-1]

s_former=s[:(n-1)//2]
s_former_rev=s_former[::-1]

s_latter=s[(n+3)//2-1:]
s_latter_rev=s_latter[::-1]

if (s==s_rev) & (s_former==s_former_rev) & (s_latter==s_latter_rev):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

    return res

S = input()
N = len(S)

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:
s = input()
l = len(s)
if list(s) != list(reversed(s)):
    print('No')
    exit()
if list(s[:(l - 1) // 2]) != list(reversed(s[:(l - 1) // 2])):
    print('No')
    exit()
if list(s[(l + 3) // 2 -1:l]) != list(reversed(s[(l + 3) // 2 -1:l])):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = 'Yes'
if s != s[::-1]:
  ans ='No'

tmp = s[:(len(s)- 1) // 2]
if tmp != tmp[::-1]:
  ans = 'No'

tmp = s[(len(s)+3) //2 - 1:]
if tmp != tmp[::-1]:
  ans = 'No'

print(ans)

Submission status: Accepted

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

k1 = int((n-1)/2)
k2 = int((n+3)/2)

ans = 0
a = 0

for i in range(k1):
    a += 1
    if s[i] != s[n-a]:
        ans += 1

a = 0
for x in range(int(k1/2)):
    a += 1
    if s[x] != s[k1-a]:
        ans += 1

a = 0
for y in range(k2-1,n):
    a += 1
    if s[y] != s[n-a]:
        ans += 1

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

Submission status: Accepted

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

if s[:n] == s[-n:]:
    print("Yes")
    
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

if s != s[::-1]:
  print("No")
  exit()
  
x = s[:((len(s)-1)//2)]
if x != x[::-1]:
  print("No")
  exit()
  
y = s[((len(s)+3)//2-1):]
if y != y[::-1]:
  print("No")
  exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = input()
ls = len(s)


def is_kaibun(s):
    rs = s[::-1]
    if s == rs:
        return True
    else:
        return False


flag = False
if is_kaibun(s):
    if is_kaibun(s[:(ls-1)//2]):
        if is_kaibun(s[(ls+3)//2-1: ls]):
            flag = True

print('Yes' if flag else 'No')

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import sys

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

s = input()
n = len(s)
a = s[::(n - 1) // 2]
b = s[(n + 3) // 2 - 1:]

if isPalin(s) and isPalin(a) and isPalin(b):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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)

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May  6 16:43:04 2020

@author: shinba
"""
from sys import exit

def kaibun(s):
    l = s[::-1]
    if s == l:
        return True
    else:
        return False

S = input()
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+1)//2:]):
    print("No")
    exit()
    
print("Yes")

Submission status: Accepted

Solution code:
S = input()
if int(len(S)) % 2 != 0:
  num = int(len(S))//2
  s1 = S[:num]
  s2 = S[num+1:]
  if s1 == s2:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if s[:n] == s[-n:]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys 
S=input()
N=len(S)
n=(N-1)//2
for i in range(n):
    if S[i]!=S[-i-1]:
        print('No')
        sys.exit()
for i in range((n-1)//2):
    if S[i]!=S[n-i-1] or S[i+n+2-1]!=S[N-i-1]:
        print('No')
        sys.exit()
for i in range(1):
    if S[i]!=S[n-i-1] or S[i+n+2-1]!=S[N-i-1]:
        print('No')
        sys.exit()     
print('Yes')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
a=list(s[i] for i in range((n-1)//2))
b=list(s[i-1] for i in range((n+3)//2,n+1))
c=0
for i in range((n-1)//2):
    if a[i]==a[-i-1]==b[i]==b[-i-1]:
        c=c+1
print("Yes" if c==(n-1)//2 else "No")

Submission status: Accepted

Solution code:
# B - String Palindrome

S = input()

ans = 'No'
N = len(S)
left = S[:(N - 1) // 2]
right = S[((N + 3) // 2) - 1:]
if left == right:
    if left == left[::-1] and right == right[::-1]:
        ans = 'Yes'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(int((n-1)/2)):
    if s[i] != s[-(i+1)]:
        print("No")
        sys.exit()
        
tmps=s[:int((n-1)/2)]
for i in range(len(tmps)//2):
    if tmps[i] != tmps[-(i+1)]:
        print("No")
        sys.exit()
    

if s[:int((n-1)/2)] != s[int((n+3)/2-1):]:
    print("No")
    sys.exit()




print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math

# S は回文である。
# N を S の長さとするとき、 S の 1 文字目から ( N − 1) / 2 文字目まで(両端含む)からなる文字列は回文である。
# S の ( N + 3) / 2 文字目から N 文字目まで(両端含む)からなる文字列は回文である。

S = input()

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

def is_half_kaibun(s):
    s = s[0:len(s)//2]
    return is_kaibun(s)

if is_kaibun(S) and is_half_kaibun(S):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
sentence = input()

def check_kaibun(strings):
    result = 0
    compare_strings = strings[::-1]
    
    if strings == compare_strings:
        return True
    else:
        return False


first_half = int((len(sentence) - 1) / 2)
second_half = int((len(sentence) + 1) / 2)
last_char = len(sentence)


if check_kaibun(sentence) == True and check_kaibun(sentence[0:first_half]) == True and check_kaibun(sentence[second_half:last_char]) == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

def kaibun(s):
    n = len(s) // 2
    return s[:n] == s[-n:]

if kaibun(S) and kaibun(S[:len(S)]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
n = len(s)
x = s[:n // 2]
y = s[(n + 2) // 2:]
ans = True
for i in range(len(s) // 2):
    if s[i] != s[~i]:
        ans = False
for i in range(len(x) // 2):
    if x[i] != x[~i]:
        ans = False
for i in range(len(y) // 2):
    if y[i] != y[~i]:
        ans = False
print(["No", "Yes"][ans])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
first = S[0:int(len(S) / 2)]
second= S[-1 * int(len(S) / 2):]

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

Submission status: Accepted

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

N=len(S)

S_left=[S[i] for i in range((N-1)//2)]
S_right=[S[i] for i in range((N+2)//2,N)]

def kaibun(X):
    count=0
    for i in range(len(X)//2):
        if S[i]==S[len(X)-1-i]:
            count+=1
    if count==len(X)//2:
        return 1
    else:
        return 0
        
print("Yes" if kaibun(S)*kaibun(S_left)*kaibun(S_right)==1 else "No")

Submission status: Accepted

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

N=S[0:int((n-1)/2)]
M=S[int((n-1)/2+1):n]

def pal(l):
    k=len(l)
    ok=0
    for i in range(len(l)):
        if l[i]==l[k-1-i]:
            ok+=1
    if ok==k:
        return 'y'
    else:
        return 'n'

if pal(S)=='y' and pal(N)=='y' and pal(M)=='y':
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys

s = input()

rs = s[::-1]

if s != rs:
    print("No")
    sys.exit()
    
s1 = s[:(len(s)-1)//2]
rs1 = s1[::-1]

if s1 != rs1:
    print("No")
    sys.exit()
    
s2 = s[(len(s)+1)//2:]
rs2 = s2[::-1]

if s2 != rs2:
    print("No")
    sys.exit()
    
    
print("Yes")

Submission status: Accepted

Solution code:
def kaibun(S):
    lenS = len(S)
#    print()
#    print(S)
#    print(S[:lenS//2])
#    print(S[:(lenS-1)//2:-1])
    if S[:lenS//2] == S[:(lenS-1)//2:-1]:
        return 1
    else:
        return 0
S = input()
lenS = len(S)
if  kaibun(S) and kaibun(S[:lenS//2]) and kaibun(S[lenS//2+1:]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
 
a=False
 
for i in range(N):
    if S[i]!=S[N-1-i]:
        print("No")
        a=False
        break
    else:
        a=True
 
if a==True:
    for j in range(int((N-3)/2)+1):
        if S[j]!=S[int((N-3)/2)-j]:
            a=False
            print("No")
            break
if a==True:
    for k in range(int((N-3)/2)+1):
        if S[int((N+1)/2)+k]!=S[N-1-k]:
            a=False
            print("No")
            break
if a==True:
    print("Yes")

Submission status: Accepted

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

a=True

for i in range(N):
    if S[i]!=S[N-1-i]:
        print("No")
        a=False
        break

if a==True:
    for j in range(int((N-3)/2)+1):
        if S[j]!=S[int((N-3)/2)-j]:
            a=False
            print("No")
            break
if a==True:
    for k in range(int((N-3)/2)+1):
        if S[int((N+1)/2)+k]!=S[N-1-k]:
            a=False
            print("No")
            break
if a==True:
    print("Yes")

Submission status: Accepted

Solution code:
def isKaibun(text):
    n=len(text)
    if text[:n//2]==text[(n+1)//2:][::-1]:
        return 1
    else:
        return 0

S=input()
n=len(S)
if isKaibun(S):
    if isKaibun(S[:n//2]):
        print("Yes")  
    else:
        print("No")   
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    S = list(input())

    if S == S[::-1]:
        # 回文
        i = (len(S) - 1) // 2
        ss = S[:i]
        if ss == ss[::-1]:
            print('Yes')
            return

    print('No')


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s = S()
n = len(s)
a = s[:int(((n-1)/2))]
b = s[int(((n+3)/2)-1):]
if s[:] != s[::-1] or a[:] != a[::-1] or b[:] != b[::-1]:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s1 = list(map(str, input()))

s1_ = list(reversed(s1))
if s1 != s1_:
    print('No')
    sys.exit()

n = len(s1)
# s2 = s1[(n+3)//2-1:]
# s2_ = list(reversed(s2))
# if s2 != s1_:
#     print('No')
#     sys.exit()

s3 = s1[:(n-1)//2]
s3_ = list(reversed(s3))
if s3 != s3_:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
import sys

s1 = list(map(str, input()))

n = len(s1)

for i in range(n//2):
    if s1[i] != s1[n-1-i]:
        print('No')
        sys.exit()

s2 = s1[(n+3)//2-1:]
for i in range((n-1)//4):
    if s2[i] != s2[(n-1)//2-1-i]:
        print('No')
        sys.exit()

del s1[(n+1)//2-1:]
for i in range((n-1)//4):
    if s1[i] != s1[(n-1)//2-1-i]:
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
import math

'''def ncr(n,r):
    if r> n: return 0;
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
'''

def solve(s):
    n = len(s)
    for i in range(n):
        if S[i] != S[n-1-i]:
            print("No")
            return
    k = (n-1)//2
    for i in range(k):
        if S[i] != S[k-i-1]:
            print("No")
            return
    for i in range((n+3)//2,n):
        if S[i] != S[n-1-i]:
            print("No")
            return
    print("Yes")
    
S = input();
solve(S)

Submission status: Accepted

Solution code:
S_list = list(input())

N = len(S_list)

is_strong = False

if list(reversed(S_list)) == S_list:
    first_half = S_list[:int((N-1)/2)]
    if list(reversed(first_half)) == first_half:
        is_strong = True

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

Submission status: Accepted

Solution code:
S = input()


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


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

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def isPal(st):
    if(st==st[::-1]):
        return True
    return False

s = input()
n = len(s)
k = (n-1)//2
p = (n+3)//2
# print(s[:k+1], s[p:])
if(isPal(s) and isPal(s[:k]) and isPal(s[p-1:])):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
f = s[0:(len(s)-1)//2]
b = s[(len(s)+3)//2-1:(len(s))+1]

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

Submission status: Accepted

Solution code:
s = str(input())

def kaibun(mojiretsu):
    n = len(mojiretsu)
    kaibuns = True
    if (n-1)%2 == 0:
        if n >= 3:
            for i in range(0,(n-1)//2):
                if not mojiretsu[i] == mojiretsu[-i-1]:
                    kaibuns = False
                    break
        else:
            kaibuns = True
    else:
        for i in range(0,n//2):
            if not mojiretsu[i] == mojiretsu[-i-1]:
                kaibuns = False
                break

    if kaibuns:
        return True
    else:
        return False
    

kaibun1 = kaibun(s)

if kaibun1:
    N = len(s)
    s2, s3 = s[0:(N-1)//2], s[(N+3)//2-1:N+1]
    kaibun2 = kaibun(s2)
    kaibun3 = kaibun(s3)
    if kaibun2 and kaibun3:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
N = int(len(S))
Sf = S[:(N-1)//2]
Sb = S[(N+3)//2-1:]
# print(Sf)
# print(Sb)
def rotate(ST) :
    SR = ST[::-1]
    #print(SR)
    if ST == SR :
        return 1
    else:
        return 0


if rotate(S) == 1 and rotate(Sf) == 1 and rotate(Sb) == 1 :
    ans = 'Yes'
else :
    ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

s = readChar()
n = len(s)

def z1(st):
	if len(st)%2==1:
		a = (len(st)-1)//2
		#print(st[:a],st[a+1:][::-1])
		if st[:a]==st[a+1:][::-1]:
			return 1
		else:
			return 0
	else:
		a = len(st)//2
		#print(st[a:],st[:a],st[a:][::-1])
		if st[:a]==st[a:][::-1]:
			return 1
		else:
			return 0

def z2(st):
	a = (len(st)-1)//2
	return z1(st[:a])

def z3(st):
	a = (len(st)+3)//2
	return z1(st[a-1:])

def jud(st):
	return z1(st)*z2(st)*z3(st)


if jud(s)==1:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
#print(s[:(l-1)//2])
#print(s[(l+3)//2-1:])
def pal(t):
    c = 1
    for i in range((len(t)-1)//2):
        if t[i] != t[-i-1]:
            c = 0
    return c
"""
if pal(s) and pal(s[:(l-1)//2]) and pal(s[(l+3)//2-1:]):
    print("Yes")
else:
    print("No")

"""
if s[:(l-1)//2] == s[(l+3)//2-1:] and pal(s):
    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:
# B - String Palindrome

S = input()

ans = 'No'

N = len(S)
left = S[:(N - 1) // 2]
right = S[((N + 3) // 2) - 1:]
if left == right:
    if left == left[::-1] and right == right[::-1]:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
n = len(s)
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

    return (s == s[::-1]), s1, s2

is_kaibun_, s1, s2 = is_kaibun(s)

if is_kaibun_:
    q1 = s[:(n-1)//2]
    is_kaibun1, s1, s2 = is_kaibun(q1)
    #print(is_kaibun(q1))
    q2 = s[(n+3)//2-1:]
    is_kaibun2, s1, s2 = is_kaibun(q2)
    #print(is_kaibun(q2))
    print('Yes' if is_kaibun1 * is_kaibun2 else 'No')
else:
    print('No')

Submission status: Accepted

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

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

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

def solve(S: str):
    N = len(S)
    return YES if is_pal(S) and is_pal(S[:N//2]) and is_pal(S[N//2+1:]) else NO


# 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
    print(solve(S))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
s = input()

len_s = len(s)

def palindrome(ss):
    flg = 1
    len_ss = len(ss)
    for i in range(len_ss):
        if ss[i]!=s[len_ss-1-i]:
            flg = 0
            break
    return flg

if palindrome(s) * palindrome(s[:(len_s-1)//2]) * palindrome(s[(len_s+3)//2:len_s]):
    ans = "Yes"
else:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:
import sys

s = str(input())
n = len(s)
left = s[0:int((n-1)/2)]
right = s[int(((n+3)/2)-1):n]
l = len(left)

for i in range(int((n-1)/2)):
    if s[i] == s[n-1-i]:
        continue
    else:
        print("No")
        sys.exit()

for i in range(int((n-1)/4)):
    if left[i] == left[l-1-i] and right[i] == right[l-1-i]:
        continue
    else:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
l = int((len(S)-1)/2)
a = 0
for i in range(l):
  if S[i] == S[2*l-i] and S[i] == S[l-1-i] and S[i+l+1] == S[2*l-i]:
    a = a + 1
  
if a == l:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t=str(input())
s=list(t)
u=s[0:int((len(t)-1)/2)]
w=s[int(((len(t)+3)/2))-1:]
if s==s[::-1] and u==u[::-1] and w==w[::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
TF = []

for i in range(len(s)//2):
    if s[i] == s[-i-1]:
        TF.append(True)
    else:
        TF.append(False)
for j in range((len(s)//2)//2):
    if s[j] == s[len(s)//2 - j - 1]:
        TF.append(True)
    else:
        TF.append(False)
if all(TF):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

i = 0

while slist[i]==slist[int(n/2 - 3/2 - i)] and i < n/2-3/2:
  i += 1

if i < n/2 - 3/2:
  print("No")
else:
  if slist[0: int(n/2-1/2)] == slist[int(n/2+1/2):n]:
    print("Yes")
  else:
    print("No")

Submission status: Accepted

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


def main():
    S = input().strip()
    N = len(S)
    for i in range(N):
        if S[i] != S[N-i-1]:
            print("No")
            exit()
    for i in range((N-1)//2):
        if S[i] != S[(N-1)//2-i-1] or S[(N+3)//2+i-1] != S[N-i-1]:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc159/tasks/abc159_b

S = input()
N = len(S)
S_2 = S[: int((N - 1) / 2)]
S_3 = S[int(((N + 3) / 2)) - 1: ]

if S == S[:: -1] and S_2 == S_2[:: -1] and S_3 == S_3[:: -1]:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = input()
N = len(S)
s = S[::-1]

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

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

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

print('Yes')

Submission status: Accepted

Solution code:
s=list(str(input()))
l=len(s)
t=list(reversed(s))
a=[]
if s==t:
  for i in range(0,int((l-1)/2)):
    if s[i]==s[int((l-1)/2-i)-1]:
      a.append(s[i])
  if len(a)==(l-1)/2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]

S=input()
N=len(S)
flag=False

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

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

print('Yes')

Submission status: Accepted

Solution code:
string=input()
kaibun=list(string)
n=int(len(kaibun))

if (kaibun==list(reversed(kaibun)))and(list(reversed(kaibun[:int((n-1)/2)]))==kaibun[:int((n-1)/2)]) and (list(reversed(kaibun[int((n+1)/2):]))==kaibun[int((n+1)/2):]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
s=int(len(S))
p=1
for i in range(int((((s-1)/2)+1)/2)):
    if S[i]==S[int((s-1)/2-(i+1))]==S[s-i-1]==S[int((s-1)/2+(i+1))]:
        p=p*1
    else:
        p=p*0
if int(p)==1:
    print('Yes')
else:
    print('No')