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:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

S = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if not check(S):
    print('No')
    quit()

S1 = S[:(N-1)//2]
if not check(S1):
    print('No')
    quit()

S2 = S[(N+3)//2-1:]
if not check(S2):
    print('No')
    quit()


print('Yes')

Submission status: Accepted

Solution code:
S = str(input())

N = len(S)

flag = True

for i in range(N):
    if S[i] == S[N - 1 - i]:
        pass
    else:
        print ('No')
        exit()

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

count = 0
for i in range((N + 3) // 2 - 1, N):
    if S[i] == S[N - 1 - count]:
        count += 1
    else:
        print ('No')
        exit()

print ('Yes')

Submission status: Accepted

Solution code:
from collections import deque
def main():
    s = list(input())

    leftsub = s[0:len(s)//2]
    rightsub = s[len(s)//2+2:-1]

    if isPalindrome(s) and isPalindrome(leftsub) and isPalindrome(rightsub):
        print("Yes")
        return
    print("No")

def isPalindrome(s):
    s_rev = s[::-1]

    for i in range(len(s)//2):
        if s[i]!=s_rev[i]:
            return False

    return True
    


if __name__ == "__main__":
    main()

Submission status: Accepted

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


def resolve():
    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")


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

cta=0
for i in range(n):
  if s[i]!=s[n-1-i]:
    cta+=1

s2=s[0:(n-1)//2]
n2=len(s2)
ctb=0
m=(n-1)//2
for i in range(n2):
  if s2[i]!=s2[n2-1-i]:
    ctb+=1

s3=s[(n+3)//2-1:n+1]
n3=len(s3)
ctc=0
x=(n+3)//2
for i in range(n3):
  if s[i]!=s[n3-1-i]:
    ctc+=1

if cta==0 and ctb==0 and ctc==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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


def judge(s):
    return palindrome(s) and palindrome(s[0:(len(s)-1)//2]) and palindrome(s[(len(s)-1)//2+1:])


S = input()
print('Yes' if judge(S) else 'No')

Submission status: Accepted

Solution code:
s = input()

l = len(s)
f=0
for i in range(l):
    if s[i]!=s[l-i-1]:
        f=1
n = l//2
for i in range(n):
    if s[i]!=s[n-i-1]:
        f=1
m = (l+3)//2
for i in range(m,l):
    if s[i]!=s[l-i-1]:
        f=1
if f==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    if S != S[::-1]:
        print("No")
        return

    tmp = S[:(N - 1) // 2]
    if tmp != tmp[::-1]:
        print("No")
        return

    tmp = S[(N + 3) // 2 - 1:]
    if tmp != tmp[::-1]:
        print("No")
        return

    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import itertools
import sys
import math
import numpy as np
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

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

    def is_kaibun(s,e):
        for i in range(s,e-s+1):
            if S[e-i] != S[i]:
                return False
        return True

    if is_kaibun(0,(N-1)//2-1) and is_kaibun(0,N-1)  and is_kaibun((N+3)//2-1,N-1):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
#200
S = input()
l = len(S)
l2 = (l-1)//2
l3 = (l+3)//2
judge = 1
for i in range(l):
    if S[i] != S[l-1-i]:
        judge = 0
for i in range(l2):
    if S[i] != S[l2-1-i]:
        judge = 0
    if S[l-1-i] != S[l3-1+i]:
        judge = 0

if judge == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
flag = True
for i in range(N//2+1):
    if S[i] != S[-i-1]:
        flag = False
        break
if flag:
    s2 = S[:N//2]
    n2 = len(s2)
    ans = 'Yes'
    for i in range(n2):
        if s2[i] != s2[-i-1]:
            ans = 'No'
            break
    print(ans)
    
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

N = len(S)

S1 = S[:(N-1)//2]
S2 = S[(N+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:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     

def iskaibun(s):
    l = 0
    r = len(s) - 1
    while l < r:
        if s[l] == s[r]:
            l += 1
            r -= 1
            continue
        else:
            return False
    return True

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

main()

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think('akasaka'), 'Yes')

    def test_2(self):
        self.assertEqual(think('level'), 'No')

    def test_3(self):
        self.assertEqual(think('atcoder'), 'No')


def solve():
    s = read()
    result = think(s)
    write(result)


def read():
    return read_line()


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(s):
    if not is_palindrome(s):
        return 'No'
    m = len(s) // 2
    if is_palindrome(s[0:m]) and is_palindrome(s[m + 1:]):
        return 'Yes'
    return 'No'


def write(result):
    print(result)


def is_palindrome(s):
    right = len(s) - 1
    for left in range(len(s)):
        if s[left] == s[right]:
            right -= 1
            continue
        return False
    return True


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

Solution code:
S = input()
N = len(S)
s1 = S[:(N-1)//2]
s2 = S[(N+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:
pal = lambda x : 1 if x==x[::-1] else 0
s=input();n=len(s)
#print(s[(n+3)//2-1:],s[:(n-1)//2],pal(s))
if s==s[::-1] 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)
ans = True
h = (N-1)//2
for i in range(h + 1):
    if S[i] != S[-1-i]: ans = False
hh = h // 2
for i in range(hh+1):
    if S[i] != S[-1-h-1-i]: ans = False
print('Yes' if ans else 'No')

Submission status: Accepted

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

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


def solve(S: str):

    n = len(S)
    p = S[0:(n-1)//2]
    q = S[(n+1)//2:]
    # print(p,q)
    if p==q:
        print(YES)
    else:
        print(NO)    

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x=input()
x=list(x)
p=0
for i in range(len(x)):
	if x[len(x)-i-1]!=x[i]:
		p=1
if p==0:
	for i in range(((len(x)-1)//2)-1):
		if x[i]!=x[((len(x)-1)//2)-1-i]:
			p=1

if p==0:
	for i in range((len(x)+3),len(x)):
		if x[i]!=x[len(x)-i-1]:
			p=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
flg = True
if S != S[::-1]:
    flg = False
if S[:(len(S)-1)//2] != S[:(len(S)-1)//2][::-1]:
    flg = False
if S[((len(S)+3)//2)-1:] != S[((len(S)+3)//2)-1:][::-1]:
    flg = False
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

S = inputS()

def check(s):
  l = list(s)
  l_ = l[::-1]
  for i in range(len(l)):
    if l[i]!=l_[i]:
      return False
  return True

L = len(S)

if check(S) and check("".join(list(S)[:(L-1)//2])) and check("".join(list(S)[(L+1)//2:])):
  print("Yes")
else:
  print("No")

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

if not is_kaibun(s):
    print('No')
    exit()
# print(s[:(len(s)-1)//2])
if not is_kaibun(s[:(len(s)-1)//2]):
    print('No')
    exit()
# print(s[(len(s)+3)//2-1:])
if not is_kaibun(s[(len(s)+3)//2-1:]):
    print('No')
    exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    for i in range(N//2):
        if S[i] != S[N - 1 - i]:
            return False
    x = (N-1)//2
    for i in range((N-1)//2):
        if S[i] != S[x - 1 - i]:
            return False
    for i in range(x + 1,N):
        if S[i] != S[N - 1 - i]:
            return False
    return True
if main():
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

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

half = len(S)//2

left = S[:half]
right = S[half+1:]

if left == left[::-1] and right == right[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
if not s == ''.join(s[::-1]):
    ans = 'No'
temp = s[:(len(s)-1)//2]
if not temp == ''.join(temp[::-1]):
    ans = 'No'
temp = s[(len(s)+2)//2:]
if not temp == ''.join(temp[::-1]):
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

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

Submission status: Accepted

Solution code:
s = list(input())
s2 = list(reversed(s))
ss = s[:((len(s)-1)//2)]
ss2 = list(reversed(ss))
sss = s[-((len(s)-1)//2):]
sss2 = list(reversed(sss))
if s == s2 and ss == ss2 and sss == sss2:
         print("Yes")
else:
         print("No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
def isKaibun(s):
	l = len(s)
	for i in range(l):
		if s[i] != s[l-1-i]:
			return False
	return True

if not isKaibun(S):
	print("No")
	exit()
if not isKaibun(S[:(N-1)//2]):
	print("No")
	exit()
if not isKaibun(S[(N+3)//2 - 1:]):
	print("No")
	exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(s):
    n = len(s)
    if n % 2 == 0:
        return False
    m = (n - 1) // 2
    if s != s[::-1]:
        return False
    left = s[:m]
    right = s[m+1:]
    if left != left[::-1]:
        return False
    if right != right[::-1]:
        return False
    return True

def main():
    if solve(input()):
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:


def resolve():
    S=input()
    N=len(S)
    if S!=S[::-1]:
        print("No")
        return
    S1=S[:(N-1)//2 ]
    if S1!=S1[::-1]:
        print("No")
        return
    S2 = S[(N+3)//2-1:]

    if S2!=S2[::-1]:
        print("No")
        return
    print("Yes")
    




if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]

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

Submission status: Accepted

Solution code:
s =str(input())
flag = True
for i in range((len(s)-1)//2):
     if s[i] != s[i + (len(s)+3)//2-1] or s[i] != s[(len(s)-1)//2-i-1]:
          flag = False



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

Submission status: Accepted

Solution code:
S = input()
ans = False
a = S[:(len(S) - 1) // 2]
b = S[(len(S) + 3) // 2 - 1:]
if S == S[::-1] and a == a[::-1] and b == b[::-1]:
    ans = True
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    S = input().rstrip('\n')
    N = len(S)
    ok = 1
    for i in range(N):
        if S[i] != S[-i-1]:
            ok = 0
        if i < N // 2:
            if S[i] != S[N//2 - i - 1]:
                ok = 0
        if i > N // 2:
            if S[i] != S[-(i - N//2 - 1) - 1]:
                ok = 0
    if ok:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

S = input()
N = len(S)


def is_kaibun(ss):
    return ss == ss[::-1]


flg = True
flg = flg and is_kaibun(S)
flg = flg and is_kaibun(S[:N // 2])
flg = flg and is_kaibun(S[N // 2 + 1:])
print('Yes' if flg else 'No')

Submission status: Accepted

Solution code:
from math import *

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

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

Submission status: Accepted

Solution code:
S = input()

l = len(S)

first = S[0:(l-1)//2]
second = S[(l+3)//2-1:]

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

Submission status: Accepted

Solution code:
S = input()
S1 = S[: len(S) // 2]
S2 = S[(len(S) // 2) + 1 :]

ans = "Yes"

for i in range(len(S) // 2):
    if S[i] != S[-1 - i]:
        ans = "No"
for i in range(len(S1) // 2):
    if S1[i] != S1[-1 - i]:
        ans = "No"
for i in range(len(S2) // 2):
    if S2[i] != S2[-1 - i]:
        ans = "No"

print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
s=input().rstrip()
n=len(s)
check=True
for i in range(n-1//2):
    if s[i]==s[n-1-i]:
        pass
    else:
        check=False
for i in range(((n-1)//2)//2):
    if s[i]==s[(n-1)//2-1-i]:
        pass
    else:
        check=False
for i in range(((n-1)//2)//2):
    if s[(n+1)//2+i]==s[(n+1)//2+(n-1)//2-1-i]:
        pass
    else:
        check=False
if check:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

S = input()
if is_palindrome(S) and is_palindrome(S[0:(len(S)//2 )]) and is_palindrome(S[len(S) //2 + 1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    S = input()
    n = N= len(S)
    def pal(s):
        return s == s[::-1]

    return pal(S) and pal(S[:(n - 1) // 2]) and pal(S[(N + 3) // 2 - 1:])

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

Submission status: Accepted

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

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

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

def solve(S: str):
    all = is_kaibun(S)
    zenhan = is_kaibun(S[:len(S)//2])
    kouhan = is_kaibun(S[len(S)//2+1:])
    if all and zenhan and kouhan:
        print(YES)
    else:
        print(NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
S = input()

N = len(S)
S_left = S[:math.ceil((N - 1) / 2)]
S_right = S[(N + 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 = input()
n = len(s)
s_1 = s[:(n-1)//2]
s_2 = s[(n-1)//2 +1:]
s_1_new = ''.join(list(reversed(s_1)))
s_2_new = ''.join(list(reversed(s_2)))
s_new = ''.join(list(reversed(s)))
if s == s_new and s_1 == s_1_new and s_2 == s_2_new:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def is_ok(s):
    return s == ''.join(reversed(s))

def main():
    s = input().strip()
    n = len(s)
    if is_ok(s) and is_ok(s[0:(n-1)//2]) and is_ok(s[(n+3)//2-1:n]):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
S1,S2=S[:(N-1)//2],S[(N+1)//2:]
if S != S[::-1] or S1 != S1[::-1] or S2 != S2[::-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
def judge(left, right):
    while left < right:
        if s[left] != s[right]:
            return False
        left += 1
        right -= 1
    return True


s = input()
n = len(s)

if judge(0, n-1) and judge(0, (n-1)//2-1) and judge((n+3)//2-1, n-1):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()


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


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

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    ss = input()
    s = [i for i in ss]
    n = len(s)
    print("Yes" if (s[:(n-1)//2] == s[:(n-1)//2][::-1] and s[(n+3)//2:] == s[(n+3)//2:] and s == s[::-1]) else "No")
        
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

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

Submission status: Accepted

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

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


def isp(S):
    m = len(S)
    flag = True
    for i in range(m//2):
        if S[i] != S[m-i-1]:
            flag = False
    return flag


def solve(S: str):
    n = len(S)
    if isp(S) and isp(S[:(n-1)//2]) and isp(S[(n+1)//2:]):
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    S = input()
    N = len(S)
    pair = [[0, N-1], [0, (N-1)//2-1], [(N+3)//2-1, N-1]]
    for i, j in pair:
        d = j-i+1
        for k in range(d//2):
            if S[i+k] != S[j-k]:
                return "No"
    return "Yes"

if __name__ == '__main__':
    print(main())