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 = [str(i) for i in input()]
n = len(s)

sa = s[0:(n-1)//2]
sb = s[(n+1)//2:n]

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

if palindrome(s) and palindrome(sa) and palindrome(sb):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
'''


#a = list(map(int, input().split()))

s = input()
n = len(s)

ans = 'Yes'
for i in range(n//2):
    if(s[i]!=s[n-1-i]):
        ans = 'No'
for i in range(n//4):
    if(s[i]!=s[(n-1)//2-1-i]):
        ans = 'No'
        
for i in range(n//4):
    if(s[(n+3)//2-1+i]!=s[n-1-i]):
        ans = 'No'
        
print(ans)

Submission status: Accepted

Solution code:
a     = list(input())
a_re  = list(reversed(a))

if a == a_re:
  if len(a) % 2 == 0:
    b = a[0:len(a)/2]
    b_re = a[0:len(a)/2]
    b_re = list(reversed(b_re))
    if b == b_re:
      print('Yes')
    else:
      print('No')
  else:
    b = a[0:int(len(a)/2)]
    b_re = a[0:int(len(a)/2)]
    b_re = list(reversed(b_re))
    if b == b_re:
      print('Yes')
    else:
      print('No')
else:
  print('No')

Submission status: Accepted

Solution code:
S = str(input())

N_half_S = len(S) // 2
half_S = S[0:N_half_S]
convS = S[::-1]
convS = convS[0:N_half_S]

N_quoter_S = N_half_S // 2
quoter_S = half_S[0:N_quoter_S]
conv_quoter_S = half_S[::-1]
conv_quoter_S = conv_quoter_S[0:N_quoter_S]

if half_S == convS and quoter_S == conv_quoter_S :
  print("Yes")
else :
  print("No")

Submission status: Accepted

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

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

pre = list(s[0:int((n-1)/2)])
rear = list(s[int((n+3)/2-1):int(n)])

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

for i in range(len(rear)):
    if rear[i-1] != rear[-i]:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = input()
s1 = s[::-1]
l=len(s)

check = 0
if(s==s1):
    if(s[0:int((l-1)/2)] == s1[int((l+3)/2)-1:l]):
        if(s[int((l+3)/2)-1:l] == s1[0:int((l-1)/2)]):
            print("Yes")
            check =1
if(check ==0):
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
def kaibun(a):
    l = len(a)
    
    
    for _ in range(l//2):
    
        if a[_] != a[l - _ - 1]:
            return False
    return True
    

if kaibun(s):
    ss = list()
    for __ in range(len(s)//2):
        ss += s[__]

    if kaibun(ss):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
S=str(input())
N=int(len(S))
a=S[:int((N-1)/2)]
b=S[int((N+1)/2):]
ans='No'
if a==b[::-1]:
  if a==a[::-1] and b==b[::-1]:
    ans='Yes'
print(ans)

Submission status: Accepted

Solution code:
def check(s):
	l = len(s)
	c = 1

	if l != 1:

		if l % 2 == 1:
			l -= 1

		for i in range(int(l/2)):
			if s[i] != s[0-1-i]:
				c = 0

	return c

if __name__ == '__main__':
	S = input()
	LEN = len(S)
	l = int((LEN-1)/2)

	r = l+1
	s1 = S[0:l]
	s2 = S[r:LEN]

	c = check(s1) * check(s2) * check(S)

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

Submission status: Accepted

Solution code:
# coding: utf-8

S = input()
# print(S)

N = len(S)
# print(N)

def judge(N, S):
    # print("S:", S)
    # rev2 = S[(N+3) // 2 - 1:]
    # rev2 = rev2[::-1]
    if N % 2 == 0:
        fr = S[:N // 2]
        rev2 = S[(N+2) // 2 - 1:]
        rev2 = rev2[::-1]
        # print("fr*:", fr)
        # print("rev2*:", rev2)
    else:
        fr = S[:(N-1) // 2]
        rev2 = S[(N+3) // 2 - 1:]
        rev2 = rev2[::-1]
        # print("fr`:", fr)
        # print("rev2`:", rev2)
        
    if fr == rev2:
        flg = True
    else:
        flg = False

    return flg

b_S = S[:(N-1) // 2]
a_S = S[(N+3) // 2 - 1:]
rev = a_S[::-1]
# print("b_S:", b_S)
# print("a_S:", a_S)
# print("rev:", rev, "\n")

if b_S == rev:
    if judge(len(b_S), b_S) == True and judge(len(a_S), a_S) == True:
        print("Yes")
    else:
        print("No")
    exit()
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
if len(S)%2!=0:
    t = S[(len(S)-1)//2:(len(S)+2)//2]
    n_s = S.replace(t, "")
    L,R = n_s[:len(n_s)//2],n_s[len(n_s)//2:]
    if L == R: print ("Yes")
    else: print ("No")
else: 
    L,R = S[:len(S)//2],S[len(S)//2:]
    if L == R: print ("Yes")
    else: print ("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sentence = input()

sentence_1 = sentence[0:int(((len(sentence)-1)/2))]
sentence_2 = sentence[int(((len(sentence)+3)/2)-1): ]
ans = "Yes"

def kaibun(S):
    count = 0
    for i in range(0,int(len(S)/2)):
        if S[i] == S[-i-1]:
            count += 1
    if int(count) != int(len(S)/2):
        global ans
        ans = "No"

kaibun(sentence)
kaibun(sentence_1)
kaibun(sentence_2)

print(ans)

Submission status: Accepted

Solution code:
s = input()
s_len = len(s)
sa_len = int((s_len-1)/2)
sk_len = int((s_len + 3)/2)

ans = 'No'
if s == s[::-1]:
  szen = s[:sa_len]
  if szen == szen[::-1]:
    skou = s[sk_len-1:]
    if skou == skou[::-1]:
      ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
import sys, re
import math
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

s = input()
n = len(s)

helfCount = math.floor(n / 2)
helfHelfCount = math.floor(helfCount / 2)

ans = "Yes"

for x in range(0, helfCount):
    if s[x] != s[n - x - 1] or (x < helfHelfCount and s[x] != s[helfCount - x - 1]) :
        ans = "No"
        break

print(ans)

Submission status: Accepted

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


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

if kaibun(S) == True and kaibun(S[0:round((N-1)/2)]) == True and kaibun(S[round((N+1)/2):N])==True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s1 = str(input())
s2 = ''
for i in range(len(s1)):
    s2 += s1[- i - 1]
if s1 != s2:
    print('No')
    exit()

t1 = s1[0 : ((len(s1)) - 1) // 2]
t2 = ''
for i in range(len(t1)):
    t2 += t1[- i - 1]
if t1 != t2:
    print('No')
    exit() 

u1 = s1[(len(s1) + 3) // 2 - 1:]
u2 = ''
for i in range(len(u1)):
    u2 += u1[- i - 1]
if u1 != u2:
    print('No')
    exit() 
print('Yes')

Submission status: Accepted

Solution code:
S = input()

N = len(S)
first = (N-1) // 2
second = (N+3) // 2
#print("first, second", N, first, second)
ans = 'Yes'
for i in range(first):
  #print("i", i)
  if not(S[i] == S[first-1-i]):
    ans = 'No'
for i in range(second -1, N):
  #print("i", i)
  #print(i - (second - 1))
  if not(S[i] == S[N-1 - (i - (second - 1))]):
    ans = 'No'
for i in range(N):
  #print(N-1-i)
  if not(S[i] == S[N-1-i]):
    ans ='No'
print(ans)

Submission status: Accepted

Solution code:
word = input()

n = len(word)

a = (n-1)//2
b = (n+3)//2

word2 = word[:a]
word3 = word[b-1:]

def kai1():
    for i in range(a):
        if(word[i] != word[-1*(i+1)]):
            return False
    return True
def kai2():
    wl = len(word2)
    if(wl % 2 == 0):
        wl = wl//2
    else:
        wl = (wl-1)//2
    for i in range(wl):
        if(word2[i] != word2[-1*(i+1)]):
            return False
    return True
def kai3():

    wl = len(word3)
    if(wl % 2 == 0):
        wl = wl//2
    else:
        wl = (wl-1)//2
    for i in range(wl):
        if(word3[i] != word3[(-1*(i+1))]):
            return False
    return True

if(kai1() and kai2() and kai3()):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    s = str(input())
    n = len(s)
    
    # is_kai = partA == partB
    if not is_kai(s):
        print('No')
        return

    partA = s[:int(((n-1)/2))]
    if not is_kai(partA):
        print('No')
        return
    
    partB = s[:int((n+1)/2)-1:-1]
    if not is_kai(partB):
        print('No')
        return
    
    print('Yes')
    return

def is_kai(word):
    n = len(word)
    if not n % 2 == 0:
        pa = word[:int((n-1)/2)]
        pb = word[:int((n+1)/2)-1:-1]
        return pa == pb
    else:
        pa = word[:int(n/2)]
        pb = word[:int(n/2)-1:-1]
        return pa == pb
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

N = len(S)

a = int((N-1)/2)-1
b = int((N+3)/2)-1

s1 = S[:a+1]
s2 = S[b:]

if S==S[::-1] and s1==s1[::-1] and s2==s2[::-1]:
    print('Yes')

else:
    print('No')

Submission status: Accepted

Solution code:
S = list(str(input()))
N = len(S)
revS = S[::-1]

num1 = int((N-1)/2)
num2 = int((N+3)/2)

strN = S[1:num1]
endN = S[num2:N]

if S == revS and strN == endN:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

def is_palindrome(a):
    n = len(a)
    i = 0
    while 2 * i < n:
        if s[i] != s[n - i - 1]:
            return False
        i += 1
    return True

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

Submission status: Accepted

Solution code:
def ABC159B(a):
    mae = [i for i in a][:(len(a)//2)]
    ushiro = [i for i in a][(-1*(-len(a)//2)):]
    if mae == ushiro[::-1]:
        return True
    else:
        return False


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

Submission status: Accepted

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


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

Submission status: Accepted

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


def judge_kaibun(S):
    n = len(S)
    center = n//2
    return S[:center] == S[-center:][::-1]


if N == 3:
    if S[0] == S[2]:
        print("Yes")
    else:
        print("No")
    exit()

full_judge = judge_kaibun(S)
pre_judge = judge_kaibun(S[:(N-1)//2])
pos_judge = judge_kaibun(S[-(N-1)//2:])

if pre_judge and pos_judge and full_judge:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math

S=input()

if S[0:math.floor((len(S)/2))] == S[math.floor((len(S)/2))+1:len(S)]:
    p = S[0:math.floor((len(S)/2))]
    q = S[math.floor((len(S)/2))+1:len(S)]
    if p == p[len(p)::-1]:
        if q == q[len(q)::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

def is_kaibunn(s):
    n = len(s)
    if n==2:
        return False
    a = ""
    b = ""
    for i in range(int((n-1)/2)):
        a += s[i]
        b += s[n-i-1]
    if a==b:
        return True
    else:
        return False

X = S[0:int((N-1)/2)]
Y = S[int((N+3)/2)-1:N]
if is_kaibunn(S) and is_kaibunn(X) and is_kaibunn(Y):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
X=input()
L=X[::-1]
N=len(X)
if N % 2 == 1:
    if L==X:
        a=int((N-1)/2)
        b=int((N+3)/2)
        Ya=X[0:a]
        LYa=Ya[::-1]
        Yb=X[b-1:N]
        LYb=Yb[::-1]
        if LYa ==Ya and LYb == Yb:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
o = "No"
if s == s[::-1]:
  o = "Yes"
n = len(s)
if s[:int((n-1)/2)] != str(s[:int((n-1)/2)])[::-1]:
  o = "No"
if s[int((n+3)/2)-1:] != (s[int((n+3)/2)-1:])[::-1]:
  o = "No"
print(o)

Submission status: Accepted

Solution code:
import math

def ispalindrome(str): return True if str == str[::-1] else False

if __name__ == "__main__":
    S = input()
    N = len(S)
    s1 = S[:math.floor((N-1)/2)]
    # print(s1)
    s2 = S[math.ceil((N+3)/2)-1:]
    # print(s2)

    if ispalindrome(S) and ispalindrome(s1) and ispalindrome(s2) :
        ret = "Yes"
    else:
        ret = "No"
    print(ret)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7


def inp(): return int(sys.stdin.readline())


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


def inpl_str(): return list(sys.stdin.readline().split())


S = input()
N = len(S)
LS = S[:(N-1)//2]
RS = S[(N+1)//2:]

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

Submission status: Accepted

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

ss = s[:int((n-1)/2)]
sss = s[int((n+1)/2):]

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
slist = list(s)
n = len(slist)
ans = 'Yes'

for i in range(int((n-1)/2)):
  if slist[i] != slist[n-1-i] or slist[i] != slist[int((n-1)/2-1-i)] or slist[int((n+3)/2-1+i)] != slist[n-1-i]:
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
moji=list(input())
for i in range(len(moji)//2):
    if moji[i] != moji[-i-1]:
        print("No")
        exit()
mojia=[]
mojib=[]
count=0
for i in moji:
    if count < len(moji)//2:
        mojia.append(i)
    if count > len(moji)//2:
        mojib.append(i)
    count = count+1
for i in range(len(mojia)//2):
    if mojia[i] != mojia[-i-1]:
        print("No")
        exit()
for i in range(len(mojib)//2):
    if mojib[i] != mojib[-i-1]:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)


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


s=input()
N=len(s)
l=int((N-1)/2 -1)
#r = int((N+3)/2 +1)
r=l+2
#print(s,l,r)
if is_kaibun(s) and is_kaibun(s[:(l+1)]) and is_kaibun(s[r:]):
    print("Yes")
else:
    print("No")


#999999999 999999999

Submission status: Accepted

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

Submission status: Accepted

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

l = len(s)
f = int((l-1)/2)
b = int((l+3)/2) - 1

# print(f,b)

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

# if :
#   print(s[:f:-1])
#   print("No")

# if :
#   print(b,":",s[b:][::-1])
#   print("No")

Submission status: Accepted

Solution code:
S = [i for i in input()]
f = 0
for i in range(len(S)//2):
  #print(S[i], S[-1-i])
  if not S[i] == S[-1-i]:
    f = 1
    print('No')
    break
#print(f)
if f == 0:
  s = S[:int((len(S)-1)/2)]
  for i in range(int(len(s)//2)):
    if not s[i] == s[-1-i]:
      f = 1
      print('No')
      break
#print(f)
if f == 0:
  s = S[int((len(S)+3)/2-1):]
  for i in range(int(len(s)//2)):
    #print(s[i], s[-1-i])
    if not s[i] == s[-1-i]:
      f = 1
      print('No')
      break
if f ==0:
  print('Yes')

Submission status: Accepted

Solution code:
S=str(input())
N=len(S)
p=0
a=0
c=0
for i in range(int((N-1)/2)):
        if S[i]==S[-i-1]:
            p+=1
if p==(N-1)/2:
    for i in range(int((N-1)/4)):
        T=S[:int((N-1)/2)]
        if T[i]==T[-i-1]:
                a+=1
    if a==int((N-1)/4):
        for y in range(int((N-(N+3)/2)/2)):
            F=S[int((N+3)/2)-1:]
            if F[y]==F[-y-1]:
                c+=1
        if c==(int((N-(N+3)/2)/2)):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
s =input()
n = len(s)
hn = int((n-1)/2)
qn = int((n+1)/4)
for i in range(qn):
  if s[i] == s[hn-i-1] and s[-i-1] == s[i-hn] and s[i] == s[-i-1]:
    pass
  else:
    print("No")
    sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
if s == s[::-1]:
    flag = True
else:
    flag = False
N = len(s)
if flag:
    new = s[0:int((N-1)/2)]
    if new == new[::-1]:
        flag = True
    else: flag = False

if flag:
    new = s[int((N+2)/2):N]
    if new == new[::-1]:
        flag = True
    else:
        flag = False

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
haba1 = int((N-1)/2)
haba2 = int((N+3)/2)
con1 = ""
con2 = ""
for i in range(0,haba1):
    con1 += S[i]
for i in range(haba2-1,N):
    con2 += S[i]
if S[::-1] != S :
    print("No")
elif con1[::-1] != con1 :
    print("No")
elif con2[::-1] != con2 :
    print("No")
else :
    print("Yes")

Submission status: Accepted

Solution code:
#/usr/bin/env python
def ispalindrome(str): return 1 if str == str[::-1] else 0

def main():
    s = input()
    l = len(s)
    s1 = s[:l // 2]
    s2 = s[l // 2 + 1:]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if is_kaibun(S)=="Yes":
    S = S[:int(M)]
    print(is_kaibun(S))
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = "Yes"
half = int((n -1) / 2)
half2 = int((n+2)/2)
a = s[:half]
a_2 = s[half+1:n]
a_2 = a_2[::-1]
if a != a_2:
    ans = "No"
else:
    if (len(a)%2) == 0:
        a_half = int(len(a)/2)
        a_3 = a[0:a_half]
        a_4 = a[a_half:len(a)]
        a_4 = a_4[::-1]
    else:
        a_half = int((len(a)+1)/2)
        a_3 = a[0:a_half]
        a_4 = a[a_half-1:len(a)]
        a_4 = a_4[::-1]
    if a_3 != a_4:
        ans = "No"
    else:
        b = s[half2:n]
        if (len(b)%2) == 0:
            b_half = int(len(b)/2)
            b_2 = b[0:b_half]
            b_3 = b[b_half:len(b)]
            b_3 = b_3[::-1]
        else:
            b_half = int((len(b)+1)/2)
            b_2 = b[0:b_half]
            b_3 = b[b_half-1:len(b)]
            b_3 = b_3[::-1]            
        if b_2 != b_3:
            ans = "No"
print(ans)

Submission status: Accepted

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

def ispalindrome(str): return 1 if str == str[::-1] else 0

if ispalindrome(s)==1:
    if ispalindrome(s[:(n-1)//2])==1:
        if ispalindrome(s[(n+2)//2:])==1:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
S = input()

N = len(S)
k = (N - 1) // 2
ans = True
for i in range(k // 2 + 1):
    if S[i] == S[k - 1 - i] == S[k + 1 + i] == S[2 * k - i]:
        continue
    ans = False
    break
if N == 3 and S[0] != S[2]:
    ans = False
print('Yes' if ans else 'No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
s2 = s[:int((n-1)/2)]
n2 = len(s2)
#print(s2)

a = ""
b = ""

if len(s2) %2 == 1:
  a = s2[:int((n2-1)/2)]
  b = s2[int(int((n2-1)/2) + 1):]
else:
  a = s2[:int((n2)/2)]
  b = s2[int(int((n2)/2)):]
#print(a)
#print(b)


# 回文の判定
if s[:int((n-1)/2)] == s[int(int((n-1)/2) + 1):] and s[:int((n-1)/2)] == s[int(int((n-1)/2) + 1):][::-1] and a[::-1] == b and s == s[::-1]:
  print ("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:

def solve():
    S = input()
    s1 = S[:int((len(S)-1)/2)]
    s2 = S[int((len(S)+1)/2):]

    for i in range(len(s1)):
        if(s1[i] == s1[len(s1)-i-1]):
            pass
        else:
            print("No")
            return

    if s1 == s2:
        print("Yes")
    else:
        print("No")

solve()

Submission status: Accepted

Solution code:
S = input()
N = len(S) - 1
n = int(N / 2)

for i in range(0, n):
  if S[i] != S[N - i]:
    print('No')
    exit()
  if i < n // 2:
    if S[i] != S[int((N / 2) - 1) - i]:
      print('No')
      exit()
    if S[int((N + 4) / 2) - 1 + i] != S[N - i]:
      print('No')
      exit()
print('Yes')

Submission status: Accepted

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

first_s = s[:int((l - 1) / 2)]
second_s = s[int((l - 1) / 2 + 1):]


def isPalindrome(s):
    for i in range(int((l - 1) / 2)):
        if s[i] != s[-(i + 1)]:
            return False

    return True


if isPalindrome(s) and isPalindrome(first_s) and isPalindrome(second_s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
cnt=0

L=int((len(S)-1)/2)
#print(L)

for i in range(L):
    #print(S[i])
    #print(S[-(i+1)])
    if S[i]==S[-(i+1)]:
        cnt+=1

if cnt!=L:
    print('No')
    exit()

S=S[0:L]
#print(S)

cnt=0
LEN=len(S)
for i in range(LEN):
    if S[i] == S[LEN-(i+1)]:
        cnt+=1

if cnt==LEN:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#B
S = input()
n = len(S)
a = list(S)
reva = a[n::-1]
sub1 = a[0:(int((n-1)/2))]
sub2 = a[int((n+3)/2-1):]
if a == reva and sub1 == sub1[len(sub1)::-1] and sub2 == sub2[len(sub2)::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
ans = 'No'

if s==s[::-1]:
    if s[0:(n-1)//2] == ''.join(list(reversed(s[0:(n-1)//2]))):
        if s[(n+1)//2:n] == s[0:(n-1)//2]:
            ans= 'Yes'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
a = int((n-1)/2)
b = int((n+3)/2)-1
sr = s[::-1]
c1 = s[0:a]
c1r = c1[::-1]
c2 = s[b:n]
c2r = c2[::-1]
if s == sr and c1 == c1r and c2 == c2r:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = list(input())

N = int(len(S))
num = 0

for i in range(int((N-1)/2)):
    if S[i] == S[int((N-1)/2-1-i)]:
        pass
    else:
        num += 1

for j in range(int((N-1)/2)):
    if S[int((N-1)/2+1+j)] == S[int(N-1-j)]:
        pass
    else:
        num += 1

for k in range(int(N)):
    if S[k] == S[N-k-1]:
        pass
    else:
        num += 1


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

Submission status: Accepted

Solution code:
def isKaibun(s):
  for a, b in zip(s, reversed(s)):
    if a != b:
      return False
  return True

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

Submission status: Accepted

Solution code:
import math

def checkKaibun(s):
    ret = True
    length = len(s)
    for i in range(math.floor(length / 2)):
        if s[i] != s[length-1-i]:
            return False
    return ret

s = input()
ret1 = checkKaibun(s)
#print("{}".format(ret1))

length = len(s)
s2 = s[0:(int)((length-1)/2)]
#print("{}".format(s2))
ret2 = checkKaibun(s2)
#print("{}".format(ret2))

s3 = s[(int)((length+1)/2):length]
#print("{}".format(s3))
ret3 = checkKaibun(s3)
#print("{}".format(ret3))

ret = "No"
if (ret1 and ret2 and ret3):
    ret = "Yes"
print("{}".format(ret))

Submission status: Accepted

Solution code:
S=list(input())

res='Yes'
N=len(S)

def ispalindrome(s):
    h = len(s) // 2
    if (len(s)==2) & (h==1):
        if s[0]==s[1]:
            return 1
        else: return 0
    else:
        for a, b in zip(s[:h], reversed(s[h+1:])):
            if a != b: return 0
        return 1
    
if ispalindrome(S)==0:
    res='No'
else:
    for i in range(N):
        s1=S[0:(N-1)//2]
        s2=S[(N+2)//2:N]
        if (ispalindrome(s1)==0):
            res='No'
        if (ispalindrome(s2)==0):
            res='No'
print(res)

Submission status: Accepted

Solution code:
S=input()
N=len(S)
flag=0
for i in range(N//2):
  if S[i]==S[N-i-1]:
    continue
  else:
    flag=1
s1=S[0:(N-1)//2]
s1l=len(s1)

s2=S[(N+3)//2-1:N]
s2l=len(s2)

if flag!=1:
  for i in range(s1l//2):
    if s1[i]==s1[s1l-i-1]:
      continue
    else:
      flag=1
      break

if flag!=1:
  for i in range(s2l//2):
    if s2[i]==s2[s2l-i-1]:
      continue
    else:
      flag=1
      break

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

else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
L = len(S)
a = int((L - 1) / 2)
b = int((L+3)/2)
S_first = S[:a]
S_second = S[(b-1):]
if S_first == S_second[::-1]:
    L_2 = len(S_first)
    if L_2 % 2 == 1:  # 半分が奇数
        a_2 = int((L_2 - 1) / 2)
        b_2 = int((L_2 + 3) / 2)
        S_first_f = S_first[:a_2]
        S_first_s = S_first[(b_2 - 1):]
        if S_first_f == S_first_s[::-1]:
            print('Yes')
        else:
            print('No')
    else:  # 半分が偶数
        a_2 = int(L_2 / 2)
        b_2 = int((L_2 + 1) / 2)
        S_first_f = S_first[: a_2]
        S_first_s = S_first[(b_2):]
        if S_first_f == S_first_s[::-1]:
            print('Yes')
        else:
            print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
import math
s = input()
a=s[::-1]
flag=0
n=len(s)
if s==a:
    a=s[0:math.ceil((n-1)/2)]
    b = a[::-1]
    if a == b:
        a = s[math.ceil((n+3)/2-1):n]
        b = a[::-1]
        if a == b:
            flag=1
if flag==0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

a=S[slice(0,int((N-1)/2))]

b=a[::-1]

if b==S[slice(int((N+1)/2),N+1)] and a==b:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

N = int((num - 1) / 2)
M = int((num + 3) / 2)

first = S[0:N]
second = S[M - 1:M+N]
if first == second:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from sys import stdin

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


def main():
    S = (stdin.readline()).replace('\n', '')
    N = len(S)

    if len(S) % 2 == 0:
        print('No')
        return

    # 回分チェック
    if not is_kaibun(S): return

    # 中に回文が含まれるか？

    for c in [S[0:N // 2], S[N // 2 + 1:]]:
        if not is_kaibun(c): return

    # output
    print("Yes")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def reverse(s):
    return s[::-1]
a=str(input())
b=reverse(a)
n=len(a)
c=a[:(n-1)//2]
d=reverse(c)
e=a[(n+3)//2-1:n]
f=reverse(e)

if a==b and c==d and e==f:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
lo=len(s)
p=[]
m=[]
c=0
q=(lo-1)//2
a=[]
b=[]
if(s.islower() and lo%2==1):
    l=[]
    l=list(s)
    ll=l[::-1]
    if(l==ll):
        c=c+1
    p=l[0:q]
    m=p[::-1]
    if(p==m):
        c=c+1
    a=l[(lo+3)//2-1:lo]
    
    b=a[::-1]
    if(a==b):
        c=c+1
if(c==3):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
S = input()
half_idx = (len(S)-1)//2
half = S[0:half_idx]
for i in range(half_idx-1):
    if half[i] != half[-1-i]:
        print("No")
        sys.exit()
    
for i in range((len(S)+1)-(len(S)+3)//2):
    if S[i] != S[-1-i]:
        print("No")
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
str = list(input())

def isKaibun(src):
  rev = src[:]
  rev.reverse()

  return src == rev


N = len(str)

def num(N):
  return N-1

s1 = num(1)
e1 = (num(N)-1) // 2 + 1
s2 = (num(N) + 3) // 2
e2 = num(N) + 1

if isKaibun(str) and isKaibun(str[s1:e1]) and isKaibun(str[s2:e2]):
  print('Yes')
else:
  print('No')