Problem:


Score : 200 points

Problem Statement

A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:

S is a palindrome.

Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.

The string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.

Determine whether S is a strong palindrome.

Constraints

S consists of lowercase English letters.

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

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

akasaka

Sample Output 1

Yes

S is akasaka.

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

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

Sample Input 2

level

Sample Output 2

No

Sample Input 3

atcoder

Sample Output 3

No



Sample input:
akasaka


Sample output:
Yes

Submission status: Accepted

Solution code:
def MI():return map(int,input().split())
def LI():return list(MI())
def ok():print("Yes");return 1
def ng():print("No");return 1


# n=int(input())

# n,m=MI()
# ans=n*(n-1)//2+m*(m-1)//2
s=input()
n=len(s)

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


for i in range(n):
    if s[i]!=s[n-i-1]:
         ng()
         exit()
for i in range(n1):
    if s1[i]!=s1[n1-i-1]:
         ng()
         exit()
for i in range(n2):
    if s2[i]!=s2[n2-i-1]:
         ng()
         exit()
ok()

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


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

    for i in range(N//2//2):
        # print('s', i)
        if s[i] != s[N-i-1]:
            print('No')
            return

    for i in range(N//2):
        # print('b', i)
        if s[i] != s[N-i-1]:
            print('No')
            return

    sl = s[(N+3)//2-1:N]
    # print(sl)
    for i in range(len(sl)//2):
        # print('c', i, sl[i], sl[len(sl)-i-1])
        if sl[i] != sl[len(sl)-i-1]:
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
n = len(s)
def check(st):
    return st == st[::-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:
inxx = input()
inxx = inxx.split()

s = inxx[0]

def ispal(x):
    return x==x[::-1]

n = len(s)
if ispal(s) and ispal(s[:(n-1)//2]):
    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:]

left_rev = list(reversed(left))
right_rev = list(reversed(right))

error = 0
for i in range((N-1)//2):
    #Sが回文かチェック
    if left[i] != right_rev[i]:
        error = 1
        break

    #leftが回文かチェック
    if left[i] != left_rev[i]:
        error = 2
        break

    #rightが回文かチェック
    if right[i] != right_rev[i]:
        error = 3
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = str(input())

len_S = len(S) // 2
left_S = S[:len_S]
right_S = S[len_S + 1:]
print("Yes" if left_S == left_S[::-1] and right_S == right_S[::-1] and left_S == right_S else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

s = sys.stdin.readline().rstrip()
n = len(s)

def main():
    res = is_palindrome(s[:n//2]) and is_palindrome(s[n//2+1:])
    return 'Yes' if is_palindrome(s) and res else 'No'

if __name__ == "__main__":
    ans = main()
    print(ans)

Submission status: Accepted

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

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)&is_kaibun(S[:int((N-1)/2)])&is_kaibun(S[int((N+3)/2)-1:]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

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

    for i in range(N//2):
        if S[i] != S[-i-1]:
            print("No")
            return
    N1 = (N-1)//2
    for i in range(N1//2):
        if S[i] != S[N1-i-1]:
            print("No")
            return
    N2 = (N+3)//2-1
    for i in range(N2, N):
        if S[i] != S[N2-1-i]:
            print("No")
            return
    print("Yes")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

s = input().rstrip()

n = len(s)
p1 = (n - 1) // 2
p2 = (n + 3) // 2
if palindrome(s) and palindrome(s[:p1]) and palindrome(s[p2-1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
x = ''.join(list(reversed(s)))
n = len(s)
ans = 'No'
if s==x:
    a = s[:(n-1)//2]
    x = ''.join(list(reversed(a)))
    if a==x:
        b = s[(n+3)//2-1:]
        x = ''.join(list(reversed(b)))
        if b==x:
            ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
SR = list(reversed(S))
length = len(S)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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

con1 = is_kaibun(S)
con2 = is_kaibun(S[0:int((N-1)/2)])
con3 = is_kaibun(S[int((N + 3) / 2)-1:])
# print(S, S[0:int((N-1)/2)-1], S[int((N + 3) / 2):])
# print(con1, con2, con3)
if (con1 and con2 and con3):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(((N-1)//2)//2+1):
    if S[i] == S[(N-1)//2-1-i] and S[i] == S[N-1-i]:
        continue
    else:
        break
else:
    for i in range((N+3)//2-1,N):
        if S[i] == S[N-1-i]:
            continue
        else:
            break
    else:
        print("Yes")
        exit()

print("No")

Submission status: Accepted

Solution code:
def isPal(s):
    l = 0
    r = len(s) - 1
    while r > l and s[l] == s[r]:
        l += 1
        r -= 1
    return r <= l

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
m=(n-1)//2
t=s[:m]
u=s[(n+3)//2-1:]
#print(t,u)
for i in range(n):
  if s[i]!=s[n-1-i]:
    print("No")
    exit()

for i in range(m):
  if t[i]!=t[m-1-i] or u[i]!=u[m-1-i]:
    print("No")
    exit()




print("Yes")

Submission status: Accepted

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

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

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

tmp = S[((n+3)//2)-1:]
if tmp != tmp[::-1]:
    print("No")
    exit()    
print("Yes")

Submission status: Accepted

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

judge = 0

for i in range((L-1)//2):
    if S[i] != S[L-1-i]:
        judge = judge + 1
        
for i in range((L-1)//2):
    if S[i] != S[((L-1)//2)-1-i]:
        judge = judge + 1
    
if judge == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input().strip()
N = len(S)
a = S[:(N-1)//2]
if S==S[::-1] and a==a[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def solve():
    S = input()
    N = len(S)
    part1 = S[:(N-1)//2]
    part2 = S[(N+3)//2-1:]

    if isKaibun(part1) and isKaibun(part2) and isKaibun(S):
        print('Yes')
    else:
        print('No')

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
S = str(input())
N = len(S)
a = (N - 1) // 2
b = (N + 3) // 2
x = 0
for i in range(N):
  if S[i] != S[N - 1 - i]:
    x = 1

for i in range(a):
  if S[i] != S[a - 1 - i]:
    x = 1

for j in range(a):
  if S[j + b - 1] != S[N - 1 - j]:
    x = 1
    
if x == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
input = raw_input

s = input()
n = len(s)

ok = True
for i in range(n):
    if s[i] != s[n-1-i]:
        ok = False
        break

if ok:
    n1 = (n-1) // 2
    for i in range(n1):
        if s[i] != s[n1-1-i]:
            ok = False
            break
if ok:
    n2 = (n+3) // 2
    i2 = n-1
    for i1 in range(n2-1, n):
        if s[i1] != s[i2]:
            ok = False
            break
        i2 -= 1
if ok:
    out = "Yes"
else:
    out = "No"
print(out)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
S = list(S)
Sr = S[::-1]
a = S[:(N-1)//2]
b = S[(N+1)//2:]
ar = a[::-1]
br = b[::-1]
if a==ar and b == br and S==Sr:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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


S = input()

N = len(S)

ans = True
ans &= check(S)
ans &= check(S[:(N - 1) // 2])
ans &= check(S[(N + 3) // 2 - 1:])

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

Submission status: Accepted

Solution code:
S = input()


def is_palindrome(s):
  s_rev = ''.join(reversed(s))
  return s == s_rev

halfS = len(S) // 2
if is_palindrome(S) and \
  is_palindrome(S[:halfS]) and \
  is_palindrome(S[1+halfS:]):
    print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=list(input())

a1=a[:int((len(a)-1)/2)]
a2=a[int((len(a)+3)/2)-1:]
if a==a[::-1] and a1==a1[::-1] and a2==a2[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
r=s[0:(len(s)-1)//2]
q=s[(len(s)+1)//2:len(s)]
count = 0
zyoukyou = "Yes"
for i in range(len(s)):
	if s[i]!=s[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
count = 0
for i in range(len(r)):
	if r[i]!=r[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
count = 0
for i in range(len(q)):
	if q[i]!=q[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
print(zyoukyou)

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    s=input()
    s=list(s)
    n=len(s)
    s1=s[0:(n-1)//2]
    s2=s[(n+3)//2-1:]
    b1=s1[::-1]
    b2=s2[::-1]
    b=s[::-1]
#    print(s1,s2,b1,b2)
    if s1==b1 and s2==b2 and s==b:
        ans="Yes"
    else:
        ans="No"

    print(ans)

if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
s = input()

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

print('Yes')

Submission status: Accepted

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

if not s == s[::-1]:
  print("No")
  exit()

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

if not x == x[::-1]:
  print("No")
  exit()

y = s[(n + 1) // 2::]

if not y == y[::-1]:
  print("No")
  exit()

print("Yes")

Submission status: Accepted

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

# print(s1)
# print(s2)
# print(_s1)
# print(_s2)

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

Submission status: Accepted

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

Submission status: Accepted

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

def is_strong(s):
    head = s[:(len(s)-1)//2]
    tail = s[(len(s)+2)//2:]
    if not is_kaibun(s):
        return False
    if not is_kaibun(head):
        return False
    if not is_kaibun(tail):
        return False
    return True

s = input()
print("Yes" if is_strong(s) else "No")

Submission status: Accepted

Solution code:
given = input()

if given != given[::-1]:
    print("No")
    exit()

former_half = given[:int(len(given)/2)]
if former_half != former_half[::-1]:
    print("No")
    exit()

latter_part = given[int((len(given) + 3) / 2 - 1):]
if latter_part != latter_part[::-1]:
    print("No")
    exit()

print("Yes")

Submission status: Accepted

Solution code:
s=list(input())
n=len(s)
a=s[:(n-1)//2]
b=s[(n+1)//2:]
s_i=s[::-1]
a_i=a[::-1]
b_i=b[::-1]

if s==s_i and a==a_i and b==b_i:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
T,U=S[:N//2],S[N//2+1:]
print(['No','Yes'][S==S[::-1] and T==T[::-1] and U==U[::-1]])

Submission status: Accepted

Solution code:
s = input()
n = len(s)
top = s[: (n - 1) // 2]
bottom = s[(n + 3) // 2 - 1 :]

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

Submission status: Accepted

Solution code:
from copy import deepcopy
S = list(input())
N = len(S)
def judge(S):
    L = len(S)
    c = deepcopy(S)
    c.reverse()
    for i in range(L):
        if S[i] != c[i]:
            return False
    return True


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

j = judge(S) and judge(a) and judge(b)
if j:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if s!=s[::-1]:
    print("No")
    exit(0)

s1 = s[:(n-1)//2]
if s1!=s1[::-1]:
    print("No")
    exit(0)

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

print("Yes")

Submission status: Accepted

Solution code:
def main():
    s = input().rstrip()
    n = len(s)
    f = True
    for i in range((n+1)//2):
        if s[i] != s[len(s)-1-i]:
            f = False
#    if f:
#        print("A")
    for i in range(n//2):
        if s[i] != s[len(s) - (n+1)//2 - 1 - i]:
            f = False
#    if f:
#        print("B")
    for i in range((n+3)//2-1, len(s)):
        if s[i] != s[len(s) - 1 - (i - ((n+3)//2 - 1))]:
            f = False
    if f:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S=str(input())
l=len(S)
flag=0
if S==S[::-1]:
    s1=S[0:(l-1)//2]
    s2=S[(l+1)//2:]
    if s1==s1[::-1] and s2==s2[::-1]:
        flag=1

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

Submission status: Accepted

Solution code:
#X=list(map(int,input().split()))
def judge(s):
  t=s[::-1]
  return s==t
S=input();N=len(S)
print("Yes"if judge(S)*judge(S[:(N-1)//2])*judge(S[(N+2)//2:])else "No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    s = input()
    ans = 1
    t = ''
    for i in range(len(s)//2):
        t += s[i]
        if s[i]!=s[-1-i]:
            ans = 0
    if not ans:
        print("No")
        return
    u = ''
    for i in range(len(t)//2):
        u += t[i]
        if t[i]!=t[-1-i]:
            ans = 0
    if not ans:
        print("No")
    else:
        print("Yes")
    return

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
M = (N - 1) // 2
X = S[:M]
L = (N + 3) // 2
Z = S[L-1:]
if S == list(reversed(S)) and X == list(reversed(X)) and Z == list(reversed(Z)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
judge = 1
for i in range(int(n / 2)):
    if s[i] != s[n - 1 - i]:
        judge = 0
        break

for i in range(int((n - 1) / 4)):
    if s[i] != s[int((n - 1) / 2 - 1 - i)]:
        judge = 0
        break

for i in range(int((n + 3) / 2), n):
    if s[i] != s[n - 1 - i]:
        judge = 0
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
front=s[:len(s)//2]
end=s[len(s)//2+1:]
answer='Yes'
for i in range(len(front)//2):
    if front[i]!=front[-i-1]:
        answer='No'
        break
if front!=end:
    answer='No'
print(answer)

Submission status: Accepted

Solution code:
s = input() #sys.stdin.readlineは最後が改行

n = len(s)
hn = (n-1)//2
hs = s[:hn]

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

print('Yes')

Submission status: Accepted

Solution code:
from sys import stdin
s = str(stdin.readline().rstrip())

if s==s[::-1]:
    n=len(s)
    s2 = s[:int((n-1)/2)]
    if s2==s2[::-1]:
        s3 = s[int((n+3)/2)-1:]
        if s3==s3[::-1]:
            print("Yes")
            exit()

print("No")
exit()

Submission status: Accepted

Solution code:
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    S = input().rstrip()

    def check(s):
        a = len(s) // 2
        for i in range(a):
            if s[i] != s[-(i+1)]:
                return False
        return True
    b = len(S) // 2
    s1 = S[:b]
    s2 = S[b+1:]
    if check(S) and check(s1) and check(s2):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	S = IS()
	N = len(S)
	rS = ''.join(list(reversed(S)))
	if(S==rS and S[:(N-1)//2]==rS[(N+3)//2-1:] and S[(N+3)//2-1:]==rS[:(N-1)//2]):
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

def check(st):
    rev = st[::-1]

    if rev == st:
        return True
    else:
        return False

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

Submission status: Accepted

Solution code:
#n, m = list(map(int,input().split()))

s = input()
f = True

if s[::-1] != s:
    f = False

t = s[:(len(s)-1)//2]
if t != t[::-1]:
    f = False

t = s[(len(s)+3) // 2 - 1:]
if t != t[::-1]:
    f = False

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

Submission status: Accepted

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

first_half = s[:int((n-1)/2)]
last_hald = s[int((n+3)/2-1):]
if first_half == last_hald:
    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:]
if (left == left[::-1]) and (right == right[::-1]) and (left == right[::-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:]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
n = len(s)
pre = s[:(n-1)//2]
suf = s[(n+3)//2-1:]
if s == s[::-1] and pre == pre[::-1] and suf == suf[::-1]:
    print("Yes")
else: print("No")

Submission status: Accepted

Solution code:
S = input().strip()
n = len(S)
S1, S2 = S[:(n-1)//2], S[(n+1)//2:]
if all((S == S[::-1], S1 == S1[::-1], S2 == S2[::-1])):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S=list(input())
A=S.copy()
A.reverse()
if S!=A:
    print("No")
    exit()
N=len(S)
kari=S[:int(((N-1)/2))]
ans=kari.copy()
ans.reverse()
if kari!=ans:
    print("No")
    exit()
tekitou=S[int(((N+3)/2)-1):]
unti=tekitou.copy()
unti.reverse()
if tekitou!=unti:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

mae = S[:int((N-1)/2)]
ato = S[int((N+3)/2)-1:]


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

Submission status: Accepted

Solution code:
S=input()
s=""
for i in range(len(S)):
    s=S[i]+s
N=len(S)
L=""
for i in range((N-1)//2):
    L=L+S[i]
M=""
for i in range((N+3)//2-1,N):
    M=M+S[i]
l=""
m=""
for i in range(len(L)):
    l=L[i]+l
for i in range(len(M)):
    m=M[i]+m
flag=False
if S==s:
    if L==l:
        if M==m:
            flag=True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
# 長さが奇数である文字列S

def check_palindrome(s):
    i = 0
    j = len(s) - 1
    while i <= j:
        if s[i] != s[j]:
            return False
        i += 1
        j -= 1
    return True
t = (len(s) - 1) // 2
u = (len(s) + 3) // 2 - 1
if check_palindrome(s) and check_palindrome(s[:t]) and check_palindrome(s[u:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=list(input())
S_f=S[:(len(S)-1)//2]
S_l=S[(len(S)+1)//2:]

if S_f!=S_l:
    print("No")
    exit()

for i in range(len(S_f)//2):
    k=-1*i-1
    if S_f[i]!=S_f[k]:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

def p(T):
    for i in range(len(T)):
        if T[i] != T[-i-1]:
            return False
    return True

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

Submission status: Accepted

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

s = input()
n = len(s)

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

Submission status: Accepted

Solution code:
S=input()

def isKaibun(SS):
  #print(SS)
  for i in range(len(SS)):
    if SS[i]!=SS[-i-1]:
      return False
  return True

N=len(S)
if not isKaibun(S):
  print("No")
elif not isKaibun(S[:(N-1)//2]):
  print("No")
elif not isKaibun(S[(N+1)//2:]):
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
def is_kaibun(s):
    i, j = 0, len(s)-1
    while i < j:
        if s[i] != s[j]:
            return False
        i += 1
        j -= 1
    return True


S = input()
N = len(S)
if is_kaibun(S) and is_kaibun(S[:N//2]) and is_kaibun(S[(N+2)//2:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

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


l = len(S)

v = S[:int((l - 1) / 2)]

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

x = int((l + 3) / 2)

v = S[x - 1:]

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

print('Yes')

Submission status: Accepted

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

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

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

     if check(s) and check(s1) and check(s2):
          print('Yes')
     else:
          print('No')


def check(s):
     s_r = ('').join(reversed(s))
     
     # print('s:{}, s_r:{}'.format(s, s_r))
     if s == s_r:
          return True
     return False

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = list(input())

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

R = list(reversed(S))
R1 = list(reversed(S1))
R2 = list(reversed(S2))

if S == R and S1 == R1 and S2 == R2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
if S == S[::-1]:
    S1 = S[:(len(S)-1)//2]
    if S1 == S1[::-1]:
        S2 = S[(len(S)+3)-1//2:]
        if S2 == S2[::-1]:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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