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 palindrome(string): return 1 if string == string[::-1] else 0


s = input()
N = len(s)
# print(s[0:(N - 1) // 2])
# print(s[(N + 3) // 2 - 1:N])

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

Submission status: Accepted

Solution code:
S = input()

N = len(S)
N1 = (N-1)//2
N2 = (N+3)//2
#print(N1,N2)
flag = 0

for i in range(N//2):
    #print(S[i], S[-(i+1)])
    if S[i] != S[-(i+1)]:
        flag = 1

for i in range(N1//2):
    #print(S[i], S[-(i+1+N1+1)])
    if S[i] != S[-(i+1+N1+1)]:
        flag = 1

for i in range(N1//2):
    #print(S[i+N2-1], S[-(i+1)])
    if S[i+N2-1] != S[-(i+1)]:
        flag = 1

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

Submission status: Accepted

Solution code:

s = list(input())
t1 = []
t2 = []
t1 = s[0:int((len(s)-1)/2)]
t2 = s[int((len(s)-1)/2)+1:]

sr = list(reversed(s))
t1r = list(reversed(t1))
t2r = list(reversed(t2))

if s == sr and t1 == t1r and t2 == t2r:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
strings = list(input())
len_str = len(strings)
ans = "Yes"

for i in range((len_str-1)//2):
  # Sは回文である。
  if strings[i] != strings[-i-1]:
    ans = "No"
for i in range((len_str-1)//4):
  # NをSの長さとするとき、Sの1文字目から (N−1)/2文字目まで(両端含む)からなる文字列は回文である。
  if strings[i] != strings[(len_str-1)//2-i-1]:
    ans = "No"
  # Sの(N+3)/2文字目からN文字目まで(両端含む)からなる文字列は回文である。
  if strings[(len_str+3)//2+i-1] != strings[-i-1]:
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

A = S[0:a]
B = S[b-1:N]
ans = 'Yes'

for i in range((len(B) // 2 + 1)):
    if B[i] != B[-i-1]:
        ans = 'No'
        break

for i in range(len(A) // 2 + 1):
    if A[i] != A[-i-1]:
        ans = 'No'
        break

if A != B: ans = 'No'

print(ans)

Submission status: Accepted

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


s = input()
fl = (len(s)-1)/2
el = (len(s)+3)/2-1
f = s[0:int(fl)]
e = s[int(el):len(s)]

if istrue(s) is False:
	print("No")
	exit()
if istrue(f) is False:
	print("No")
	exit()
if istrue(e) is False:
	print("No")
	exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
s_list = list(s)
n = len(s_list)
s_r = str(''.join(reversed(s_list)))
s_f = ''.join(s_list[:int((n-1)/2)])
s_b = ''.join(s_list[int((n+3)/2-1):])
if (s == s_r) and (s_f == s_b):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())
A=list(reversed(S))#全体の回文
N=len(S)
S1=S[:(N)//2]
rS1=list(reversed(S1))
if S1!=rS1:
    print("No")
    exit()
S2=S[(N+1)//2:]
rS2=list(reversed(S2))
if S2!=rS2:
    print("No")
    exit()
if S!=A:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

exa = S[::]
exb = S[:mojisu//2]
exc = S[(mojisu+3)//2-1::]

if exa==exa[::-1] and exb==exb[::-1] and exc==exc[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
string_values = list(input())
size = len(string_values)
half_size = int((size - 1) / 2)
half_last_size = int((size + 3) / 2)

count = 0
is_true = True
for string_value in string_values:
    if string_value != string_values[size - count - 1]:
        is_true = False
    if count > half_size:
        break
    count += 1

count = 0
for string_value in string_values:
    if string_value != string_values[half_size - count - 1]:
        is_true = False
    if count + 1 == half_size:
        break
    count += 1

count = 0
check_count = 0
for string_value in string_values:
    if count + 1 < half_last_size:
        count += 1
        continue
    if string_value != string_values[size - check_count - 1]:
        is_true = False
    check_count += 1
    count += 1


answer = "No"
if is_true:
    answer = "Yes"
print(answer)

Submission status: Accepted

Solution code:
import copy
S = list(input())
N = len(S)
ReS = copy.copy(S)
o = 1
for i in S:
    ReS[N-o] = i
    o += 1
if S == reversed(S):
    print("Yes")
if S == ReS:
    if S[0:int((N-1)/2)] == ReS[int((N+1)/2): N]:
        if S[int((N+1)/2): N] == ReS[0:int((N-1)/2)]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
        print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

def chk2(s):
    global N
    r_idx = int((N-1)/2)
    w = s[0:r_idx]
    return str(w) == str(w[::-1])

def chk3(s):
    global N
    l_idx = int((N+3)/2)
    w = s[l_idx-1:]
    return str(w) ==  str(w[::-1])

f = False
if chk1(S):
    if chk2(S):
        if chk3(S):
            f = True
            print("Yes")

if f == False:
    print("No")

Submission status: Accepted

Solution code:
def reverse(s): 
    return s[::-1] 
  
def isPalindrome(s): 
    rev = reverse(s) 

    if (s == rev): 
        return True
    return False
s = input()
N = len(s)
ans = isPalindrome(s) & isPalindrome(s[0:int((N-1)/2)]) & isPalindrome(s[int((N+1)/2):N])
  
if ans == True: 
    print("Yes") 
else: 
    print("No")

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy
import bisect
import heapq


def dfs(s, prev, pre):
  val[s] += Ope[s] + prev
  for i in G[s]:
    if(i == pre):
      continue
    dfs(i, val[s], s)

def bfs(sx, sy, n):
  que = deque([[sy,sx]])
  while que:
    y,x = que.popleft()
    for i,j in D:
      if(x+i<0 or y+j<0 or x+i>W-1 or y+j>H-1):
        continue
      dist = G[y+j][x+i]
      if(G[y+j][x+i] != "X"):
        if(type(G[y+j][x+i]) is str):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        elif(dist>G[y][x]+1):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        

def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def ispalindrome(s):
  h = int(math.floor(len(s) / 2))
  #print(s[h+1:], s[:h])
  hh = h+1
  if(len(s)%2==0):
    hh = h
  for a, b in zip(s[hh:], reversed(s[:h])):
    if a != b: return 0
  return 1

#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#V, E, r = map(int, input().split())
#INF = V * 10001

S = str(input())
ans = "No"
h = int(math.floor(len(S) / 2))

#print(S[5:])

if(ispalindrome(S)==1):
  if(ispalindrome(S[:h])==1):
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
s = input()

answer = "Yes"

s_list = list(s)
s_list_reverse = list(reversed(s))

n = int((len(s_list)-1)/2)
m = int((len(s_list)+3)/2)

for i in range(len(s_list)):
  if s_list[i] != s_list_reverse[i]:
    answer = "No"
    break

    
s_list_1 = s_list[0:n]
s_list_1_reverse = list(reversed(s_list_1))

for i in range(len(s_list_1)):
  if s_list_1[i] != s_list_1_reverse[i]:
    answer = "No"
    break

s_list_2 = s_list[m-1:]
s_list_2_reverse = list(reversed(s_list_2))    
    
for i in range(len(s_list_2)):
  if s_list_2[i] != s_list_2_reverse[i]:
    answer = "No"
    break
    
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
# from datetime import date, timedelta
# from heapq import *
import heapq
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
# input = sys.stdin.readline


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

import random
def main():
    s = list(input())
    n = len(s)
    if n == 3:
        if s[0] == s[2]:
            print("Yes")
        else:
            print("No")
        exit()
    
    a = s[:(n - 1) // 2]
    b = s[(n + 3) // 2-1:]
    # print(a,b)
    for i in range(len(a) // 2):
        if (a[i] != a[len(a) - 1 - i]):
            print("No")
            exit()


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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

s = input()

list = list(s)
n = len(list)

list_l = list[:n//2]
list_r = list[(n//2)+1:]

n_l = len(list_l)
n_r = len(list_r)

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

for i in range(n_l):
    if list_l[i] != list_l[-i-1]:
        print('No')
        sys.exit()

for i in range(n_r):
    if list_r[i] != list_r[-i-1]:
        print('No')
        sys.exit()

print('Yes')

Submission status: Accepted

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

ans = 'No'
n = len(S)
if is_batch(S):
    if is_batch(S[0:(n//2)]):
        if is_batch(S[(n+2)//2:n+1]):
            ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
import math
s = input()
n = len(s)
x = math.floor((n-1)/2)
y = math.floor((n+3)/2)

if (s[:x] == s[y-1:]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

ans = True
n = len(s)
if s != s[::-1]:
    ans = False

front = s[0:(n-1)//2]
if front != front[::-1]:
    ans = False


back = s[(n+3)//2-1:n+1]
if back != back[::-1]:
    ans = False

# print(s, front, back)

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

Submission status: Accepted

Solution code:
#!python3.4.3

S = input()
N = len(S)


def hantei(s, n):
  flag = False
  if n % 2 == 1:
    flag = s[:n//2] == s[:n//2:-1]
  else:
    flag = s[:n//2] == s[:(n//2)-1:-1]
  if flag:
    return True
  else:
    return False

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

if hantei(S, N) and hantei(S1, len(S1)) and hantei(S2, len(S2)):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if S1==S2 and S1[0:(n-1)//2]==S1[(n-1)//2::-1] and S2[0:(n-1)//2]==S2[(n-1)//2::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:

s = input()
n = len(s)
s2 = s[:(n-1)//2]
s3 = s[(n+3)//2-1:]
n2 = len(s2)
n3 = len(s3)
f = True

for i in range(n//2):
#    print(s[i])
#    print(s[n-(i+1)])
    if s[i] != s[n-(i+1)]:
        f = False
        break

for i in range(n2//2):
#    print(s[i])
#    print(s[n-(i+1)])
    if s2[i] != s2[n2-(i+1)]:
        f = False
        break

for i in range(n3//2):
#    print(s[i])
#    print(s[n-(i+1)])
    if s3[i] != s3[n3-(i+1)]:
        f = False
        break




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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
# for i,si in enumerate(s[:(n-1//2)//2]):
#     if i+1 <len((n-1//2)//2):
def res():
    fr=(n-1//2)//2
    # for i in s[:fr//2]:
    sf=s[:(n-1)//2]
    for i,sft in enumerate(sf[:len(sf)//2]):
        if sft != sf[len(sf)-1-i]:
            return "No"
    
    sb=s[:(n+3)//2]
    for i,sbt in enumerate(sb[:len(sb)//2]):
        if sbt != sb[len(sf)-1-i]:
            return "No"
    
    for i,st in enumerate(s[:len(s)//2]):
        if st != s[len(s)-1-i]:
            return "No"
    
    return "Yes"

print(res())

Submission status: Accepted

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

Submission status: Accepted

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

s = input()
n = len(s)
a = is_kaibun(s)
b = is_kaibun(s[:int((n-1)/2)])
c = is_kaibun(s[int((n+1)/2):])
if(a and b and c):print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
S = input()

if (S == S[::-1]):
    if (S[0:(len(S)-1)//2] == S[0:(len(S)-1)//2][::-1]):
        if (S[(len(S)+3)//2-1:len(S)] == S[(len(S)+3)//2-1:len(S)][::-1]):
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    P = S[:(N-1)//2]
    Q = S[(N+3)//2 - 1:]
    M = len(P)
    K = len(Q)
    if (S[:N//2] == S[N//2 + 1:][::-1]) and \
            (P[:M//2] == P[(M//2 + 1 if M % 2 == 1 else M//2):][::-1]) and \
            (Q[:K//2] == Q[(K//2 + 1 if K % 2 == 1 else K//2):][::-1]):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - String Palindrome
S = input()
N = len(S)

# 文字列をリストに
S_org = list(S)
S_org
S_org_r = reversed(S_org)
S_former = S_org[0:int((N-1)/2)]
S_former_r = reversed(S_former)
S_latter = S_org[int((N+3)/2)-1:N+1]
S_latter_r = reversed(S_latter)

# リストを文字列に
S_org_str = ''.join(S_org)
S_org_r_str = ''.join(S_org_r)
S_former_str = ''.join(S_former)
S_former_r_str = ''.join(S_former_r)
S_latter_str = ''.join(S_latter)
S_latter_r_str = ''.join(S_latter_r)

# 条件判定
if S_org_str == S_org_r_str and S_former_str == S_former_r_str  and S_latter_str == S_latter_r_str:
    print('Yes')
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())

sr = s[::-1]

# print(s)
# print(sr)

n = len(s)

ans = "Yes"

for i in range(n//2 + 1):
  if s[i] != sr[i]:
    ans = "No"

if ans == "Yes":
  ss = s[0: int(((n-1)/2))]
  # print(ss)
  ssr = ss[::-1]
  ns = len(ss)
  for i in range(ns // 2 + 1):
    if ss[i] != ssr[i]:
      ans = "No"

if ans == "Yes":
  sl = s[int((n+3)/2)-1:]
  # print(sl)
  slr = sl[::-1]
  nsl = len(sl)
  for i in range(nsl // 2 + 1):
    if sl[i] != slr[i]:
      ans = "No"

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
def check(string):
    if (string[::-1] == string):
        return True
    return False

string = input()
mid = int((len(string)-1)/2)

if check(string) and check(string[:mid]) and check(string[mid+1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()


def main(s):
    l = len(s)

    left = s[:int((l - 1) / 2)]
    right = s[int((l + 3) / 2) - 1:l]

    s_rev = ''.join(list(reversed(s)))
    left_rev = ''.join(list(reversed(left)))
    right_rev = ''.join(list(reversed(right)))

    if s == s_rev and left == left_rev and right == right_rev and ( 3 <= l <= 99 ):
        res = 'Yes'
    else:
        res = 'No'
    return res


print(main(S))

Submission status: Accepted

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
s = l()
a = s[:len(s)//2]
b = s[len(s)//2+1:]
print("Yes" if a == b else "No")

Submission status: Accepted

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

ans = "Yes"
N = len(S)

i = 0
while i < N:
  k = N - i
#  print(S[i]),
# print(S[k-1])
  if S[i] != S[k -1]:
    ans = ' No'
  i += 1

i = 0
l = (N - 1) // 2

while i < l:
  k = l -i

  if S[i] != S[k - 1]:
    ans = 'No'
  i += 1

i = (N + 3) // 2
while i < N:
  m = N - i
  if S[i] != S[m -1]:
    ans = 'No'
  i += 1

print(ans)

Submission status: Accepted

Solution code:
s = input()

flag = 0
slen = len(s)

if s == s[::-1]:
  flag += 1
  
s1 = s[::(slen-1)//2]
if s1 == s1[::-1]:
  flag += 1
  
s2 = s[(slen+3)//2-1:]
if s2 == s2[::-1]:
  flag += 1

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

Submission status: Accepted

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

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

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

if kaibunCheck(S) == True and kaibunCheck(S1) == True and kaibunCheck(S2) == True:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
num = (n-1)//2
a = 1

if num % 2 == 0:
    num_e = num // 2 
    for i in range(num_e):
        if (s[i] != s[num-i-1]) or (s[i] != s[num + i + 1]) or (s[i] != s[n-i-1]):
            a = 0
            break

else:
    num_o = num // 2
    if s[num_o] != s[num+num_o+1]:
        a = 0
    else:
        for i in range(num_o):
            if s[i] != s[num-i-1] or s[i] != s[num + i + 1] or s[i] != s[n-i-1]:
                a = 0
                break
if a:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(map(str, input()))
S_reverse = list(reversed(S))
index_1 = 0
index_2 = 0
index_3 = 0

for i in range(0, len(S)):
    if S[i] != S_reverse[i]:
        index_1 = 1
        break

left = int((len(S) - 1) / 2)
S_left = S[0:left]
S_left_reverse = list(reversed(S_left))
right = int((len(S) + 3) / 2) - 1
S_right = S[right:len(S)]
S_right_reverse = list(reversed(S_right))


for i in range(0, len(S_left)):
    if S_left[i] != S_left_reverse[i]:
        index_2 = 1
        break

for i in range(0, len(S_right)):
    if S_right[i] != S_right_reverse[i]:
        index_3 = 1
        break

index = index_1 + index_2 + index_3
if index == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if s == s[::-1]:
  #前半部分の回文チェック
  p = int((n-1)/2)
  f = s[:p]
  if f == f[::-1]:
    #後半部分の回文チェック
    q = int((n+3)/2)
    l = s[q-1:]
    if l == l[::-1]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
def main():

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

    str= input()
    n=len(str)
    N=int((n-1)/2)

    s_first, s_second, s_last = str[:N], str[N:N+1], str[N+1:]
    # print(s_first,s_second,s_last)
    if ispalindrome(str) and (n+1)%2==0:
        if ispalindrome(s_first) and ispalindrome(s_last):
            print("Yes")
            return
        else:
            print("No")
            return
    else:
        print("No")
        return
main()

Submission status: Accepted

Solution code:
S=input()
N=len(S)
S_r=S[::-1]
S2=S[:int((N-1)/2)]
S2_r=S2[::-1]
S3=S[int((N+3)/2)-1:]
S3_r=S3[::-1]
x=0
a=0
b=0
c=0
for i in range(int((N-1)/2)):
    if S[i]==S_r[i]:
        a+=1
if a==int((N-1)/2):
    x+=1
    for i in range(len(S2)):
        if S2[i]==S2_r[i]:
            b+=1
if b==len(S2):
    x+=1
    for i in range(len(S3)):
        if S3[i]==S3_r[i]:
            c+=1
if c==len(S3):
    x+=1

if x==3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
a=s[::-1]
n=len(s)

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

b=s[:int((n-1)/2)]
c=b[::-1]

if b!=c:
    print('No')
    exit()

d=s[int((n+3)/2)-1:]
e=d[::-1]   

if d!=e:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

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

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

if(ispalindrome(s)*ispalindrome(s1)*ispalindrome(s2) == 1):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S=input()

SS=S[::-1]

#print(SS)

if(S!=SS):
    print("No")
    exit()

Slen=int((len(S)-1)/2)
S1=S[:Slen]
SS1=S1[::-1]

if(S1!=SS1):
    print("No")
    exit()
    
Slen=int((len(S)+3)/2)
S1=S[Slen-1:]
SS1=S1[::-1]
#print(S1)
if(S1!=SS1):
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
# input
S = input()

# process
def check(s, i, j):
    if (j-i)%2 == 1:
        l = (j-i-1)//2
        for s, t in zip(s[i:l], reversed(s[l+1:j])):
            if s != t:
                return False
    else:
        l = (j-i)//2
        for s, t in zip(s[i:l], reversed(s[l:j])):
            if s != t:
                return False
    return True        

result = check(S, 0, len(S))
result &= check(S, 0, (len(S)-1)//2)
result &= check(S, (len(S)+3)//2-1, len(S))

# output
print("Yes" if result else "No")

Submission status: Accepted

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

Sr = S[::-1]

S2 = S[:int((N-1)/2)]
S2r =S2[::-1]
S3 = S[int((N+3)/2)-1:N]
S3r =S3[::-1]

#print(S2,S2r)
#print(S3,S3r)
if S ==Sr and S2== S2r and S3==S3r:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
##B
S = str(input())
N = int(len(S))
##print(N)
S1 = S[0:(N-1)//2]
N1 = len(S1)
S2 = S[(N+3)//2-1:N]
N2 = len(S2)

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

Submission status: Accepted

Solution code:
import math
import sys

s = input()
n= len(s)


"""
sが回文かどうかのチェック
"""
end = n
for i in range(end):
  head = s[i]
  tail = s[end-i-1]
  if head != tail:
    print('No')
    sys.exit()
    
"""
2つめチェック
"""
end = int((n-1)/2)
for i in range(end):
  head = s[i]
  tail = s[end-i-1]
  if head != tail:
    print('No')
    sys.exit()

"""
3つめチェック
"""
start=int((n+3)/2)-1
end = n
iteration=0
for i in range(start,end):
  head = s[i]
  tail = s[end-iteration-1]
  iteration+=1
  if head != tail:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

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

def palindrome(string):
  return True if string==string[::-1] and string[0]==string[-1] else False

if not palindrome(S):
  print('No')
  exit(0)

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

if not palindrome(left):
  print('No')
  exit(0)
if not palindrome(right):
  print('No')
  exit(0)

print('Yes')

Submission status: Accepted

Solution code:
#B
import sys,math
s = list(input())
# print(s)
for i in range(len(s)):
    # print(s[i],s[len(s)-i-1])
    if s[i] != s[len(s)-i-1]:
        print('No')
        sys.exit()
n = (len(s) - 1) // 2
# print(n)
for i in range(n):
    # print(s[i], s[n - 1 - i])
    if s[i] != s[n - 1 - i]:
        print('No')
        sys.exit()
start = math.ceil((len(s) + 3) / 2)-1
# print(start)
for i in range(start, len(s)):
    # print(s[i], s[n - i])
    if s[i] != s[n - i]:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
if True:
    s = input()


else:
    s="attaiatta"


def isKaibun(data):
    zen = data[0:int(len(data)/2)]
    go=""
    if len(data)%2 == 1:
        range_from = int(len(data)/2)+1
    else:
        range_from = int(len(data)/2)

    for i in range(range_from,len(data)):
        go = data[i:i+1] + go
    # print(zen)
    # print(go)
    return (zen == go)

n=len(s)
# print(n)
isKaibun(s)
before = s[0:int((n-1)/2)]
after = s[int((n+3)/2)-1:n]
# print(before)
# print(after)
if isKaibun(s) and isKaibun(before) and isKaibun(after):
    print("Yes")
else:
    print("No")

# isKaibun("atta")

Submission status: Accepted

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

Submission status: Accepted

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

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

m = len(head_1)

if str(head_1) != str(tail_1):
    print('No')
else:
    head_2 = head_1[:m // 2]
    tail_2 = head_1[m:(m - 1) // 2:-1]

    if str(head_2) == str(tail_2):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
sign = 0
limit_1 = int((n-1)//2)

judge = limit_1%2
if judge == 0:
  limit_2 = int(limit_1//2)
elif judge == 1:
  limit_2 = int((limit_1+1)//2)

for i in range(limit_2):
  if not (s[i] == s[i-limit_1]):
    sign = 1

if s[:limit_1] != s[limit_1+1:] :
  sign = 1

if sign == 0:
  ans = "Yes"
elif sign == 1:
  ans = "No"
  
print(ans)

Submission status: Accepted

Solution code:
def pal(p):
    pp = p
    r = True
    for i in range(len(p)):
        if p[i] != pp[-i-1]:
            r = False
            break
    return r

s = input()
n = len(s)
r = 'No'
if pal(s) and pal(s[0:int((n - 1) / 2)]) and pal(s[int((n + 2) / 2):n]):
    r = 'Yes'
print(r)

Submission status: Accepted

Solution code:
s = input()

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

nagasa = (int(len(s)) - 1) // 2
nagasa2 = (int(len(s)) +3 ) // 2
nagasa3 = int(len(s))

result = ispalindrome(s) #回文なら1

tmp = s[0:nagasa]
result = result + ispalindrome(tmp)

tmp2 = s[nagasa2-1:nagasa3]
result = result + ispalindrome(tmp2)

if result == 3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def PalindromeCheck(str_s):
    result = "Yes"
    for i in range((len(str_s) // 2)):
        #print(str_s[i])
        if str_s[i] != str_s[len(str_s) -1 - i]:
            result = "No"
            break
    return result

def StrongCheck(str_s):
    result = "Yes"
    if PalindromeCheck(str_s) == "No":
        result = "No"
    if PalindromeCheck(str_s[0:(len(str_s) -1) // 2]) == "No":
        result = "No"
    if PalindromeCheck(str_s[(len(str_s) + 3) // 2:len(str_s) - 1]) == "No":
        result = "No"
    return result


str_s = input()
print(StrongCheck(str_s))

Submission status: Accepted

Solution code:
def kaibunChk(txt):
    txtLen = len(txt)
    for si in range(txtLen):
        if txt[si] != txt[txtLen - si - 1]:
            print("No")
            exit()


s = input()
slen = len(s)
clen = slen // 2

kaibunChk(s)
kaibunChk(s[:clen])
kaibunChk(s[clen + 1:])

print("Yes")

Submission status: Accepted

Solution code:
s = input()

def check(ss):
    idx = 1
    nn = (len(ss)-1)//2
    if len(ss) == 1:
        return True
    elif len(ss) == 2:
        if ss[0]==ss[1]:
            return True
        else:
            return False
    for i in range(nn):
        #print('s ss[i], ss[-i-1]: ', s, ss[i], ss[-i-1])
        if ss[i] != ss[-i-1]:
            return False
    return True
    

if check(s):
    if check(s[:(len(s)-1)//2]):
        if check(s[(len(s)+3)//2-1:]):
            print('Yes')
            exit()

print('No')

Submission status: Accepted

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

c = (len(s)-1) // 2

l = s[:c]
r = s[-c::][::-1]

ss = s[(n+3)//2-1:]
nn = len(ss)
cc = (nn-1) // 2
ll = ss[:cc]
rr = ss[-cc::][::-1]

if n == 3:
    if s[0] == s[-1]:
        print('Yes')
    else:
        print('No')
elif l == r and ll == rr:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

s = readline().rstrip().decode('utf-8')

n = len(s)

def judge(k):
    l = len(k)
    if l%2==0:
        a = k[:l//2]
        b = k[l//2:]
        b = b[::-1]
        if a==b:
            return True
        else:
            return False
    else:
        a = k[:l//2]
        b = k[l//2+1:]
        b = b[::-1]
        if a==b:
            return True
        else:
            return False
if judge(s) and judge(s[:(n-1)//2]) and judge(s[(n+3)//2-1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

kaibun = True
N = len(S)

if not S[:] == S[::-1]:
    kaibun = False
if not S[:(N-1)//2:] == S[(N-1)//2-1::-1]:
    kaibun = False
if not S[(N+3)//2-1:] == S[:(N+3)//2-2:-1]:
    kaibun = False

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

Submission status: Accepted

Solution code:
S=str(input())

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

if S!=S[::-1]:
    f=0
if s1!=s1[::-1]:
    f=0
if s2!=s2[::-1]:
    f=0

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

Submission status: Accepted

Solution code:
def kaibun(s):
    flg = False
    if len(s) % 2 == 0:
        if s[0:int((len(s)/2))] == s[int(len(s)/2):len(s)][::-1]:
            flg =True
    else:
        
        if s[0:int((len(s)-1)/2)] == s[int((len(s)+1)/2):len(s)][::-1]:
            flg =  True
    return flg



s = input()
ans = "No"



if kaibun(s):
    if kaibun(s[0:int((len(s)-1)/2)]) and kaibun(s[int((len(s)+1)/2):len(s)]):
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
s = (input())
#a,b = map(int,input().split())
n = len(s)
b = n//2
s1 = s[0:b]
s2 = s[b+1:]
#print(s1,s2)
if n == 3:
    if s[0] == s[-1]:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
        
flag1 = True
for i in range(len(s1)//2):
    if s1[i] == s1[-i-1]:
        flag1 = True
    else:
        flag1 = False
        break

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

Submission status: Accepted

Solution code:

def main():
    s = input()
    n = len(s)
    result = "No"
    if s == s[::-1]:
        m = (n - 1) // 2
        if s[:m] == s[:m][::-1]:
            l = (n + 3) // 2
            if s[l - 1:] == s[l - 1:][::-1]:
                result = "Yes"
    print(result)

if __name__ == '__main__':
    main()