Problem:


Score : 200 points

Problem Statement

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

S is a palindrome.

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

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

Determine whether S is a strong palindrome.

Constraints

S consists of lowercase English letters.

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

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

akasaka

Sample Output 1

Yes

S is akasaka.

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

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

Sample Input 2

level

Sample Output 2

No

Sample Input 3

atcoder

Sample Output 3

No



Sample input:
akasaka


Sample output:
Yes

Submission status: Accepted

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

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

Submission status: Accepted

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

l_f=s[0:(n-1)//2]
l_e=s[((n+3)//2)-1:n]

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

if palindrome(s) and palindrome(l_f) and palindrome(l_e):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
t = s[:(n - 1) // 2]
u = s[(n + 1) // 2:]
if s == s[::-1]:
    if t == t[::-1]:
        if u == u[::-1]:
            print("Yes")
            exit(0)
print("No")

Submission status: Accepted

Solution code:
def solve(s):
  s = list(s)
  n = len(s)
  ans = check_palindrome(s) & check_palindrome(s[:int(((n-1)//2))]) & check_palindrome(s[int(((n+3)//2)-1):])
  return "Yes" if ans else "No"


def check_palindrome(st):
  a = list(st)
  b = list(reversed(st))
  return a == b




s = str(input())
# n, m = [int(s) for s in input().split(" ")]
print(solve(s))

Submission status: Accepted

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

def Main(S):
    N = len(S)
    a = S[:(N-1)//2]
    b = S[(N+2)//2:]
    return "Yes" if check(S) and check(a) and check(b) else "No"

def main():
    S = str(input())
    print(Main(S))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def kaibun(x):
  if(x != ''.join(list(reversed(x)))):
    return 0
  else:
    return 1


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

  num1 = kaibun(s[:int((s_num - 1)/2)])
  num2 = kaibun(s[(int((s_num + 1)/2)):s_num])

  if(num1 == 1 and num2 == 1):
    if(s == ''.join(list(reversed(s)))):
      print('Yes')
    else:
      print('No')
  else:
    print('No')

if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
flag = False

if S == S[::-1]:
    if S[:len(S)//2] == S[:len(S)//2][::-1]:
        if S[(len(S)+1)//2:] == S[(len(S)+1)//2:][::-1]:
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

flag=True
for i in range(N//2):
    if S[i]!=S[N-i-1]:
        flag=False
for j in range(N//2//2):
    if S[N-N//2+j]!=S[N-j-1]:
        flag=False             
        
if flag==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
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
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
N = len(S)

S2 = S[:N//2]
S3 = S[N//2+1:]

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

Submission status: Accepted

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

Submission status: Accepted

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

check = 0

n = len(s)

re_s =list(reversed(s))

if re_s == s:
    check += 1

split_s = s[:(n-1)//2]
re_ss = list(reversed(split_s))
if re_ss == split_s:
    check += 1

saigo_s = s[(n+3//2):]
re_sss = list(reversed(saigo_s))

if re_sss == saigo_s:
    check += 1

if check == 3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a = input()
b = len(a)
c = (b-1)//2
d = (b+3)//2 - 1
e = a[0: c]
f = a[d: b]

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

Submission status: Accepted

Solution code:
class atcorder:
    
    S=list(input())
    inv=list(reversed(S))
    i=0
    j=0
    if S==inv:
        i+=1
        
    N=int((len(S)-1)/2)
    for x in range(N-1):
        if S[x]==S[N-1-x] and inv[x]==inv[N-1-x]:
            pass
        else:
            j+=1
                
    if j==0 and i==1:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
s=input()
a=[]
b=[]
z=0
for i in range((len(s)-1)//2):
  a.append(s[i])
for i in range((len(s)-1)//2+2-1,len(s)):
  b.append(s[i])
for i in range((len(s)-1)//2):
  if a[i]==a[(len(s)-1)//2-1-i]:
    z+=1
for i in range((len(s)-1)//2):
  if b[i]==b[(len(s)-1)//2-1-i]:
    z+=1
for i in range(len(s)):
  if s[i]==s[len(s)-i-1]:
    z+=1
if z==len(s)-1+len(s):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

def check(s):
    sr = s[::-1]
    if s == sr:
        return True
    else:
        return False
    
if check(s) and check(s1) and check(s2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if s == s[::-1]:
    if t == t[::-1]:
        if u == u[::-1]:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

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

def kaibun(st):
  sta = list()
  for k in range(len(st)//2):
    sta.append(st[k])
  for k in range(len(st)//2):
    if st[-(-len(st)//2)+k] != sta.pop():
      return False
  return True

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
cnt = 0
for i in range(n//2):
    if s[i]==s[n-1-i] and s[i]==s[i+(n+1)//2]:
        pass
    else:
        cnt += 1
if cnt == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if s[:int((n-1)/2)] == s[int((n+3)/2)-1:] and s[:int((n-1)/2)] == (s[int((n+3)/2)-1:])[::-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:n]
if s != s[::-1] or s1 != s1[::-1] or s2 != s2[::-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
S = input()

if (len(S)%2 == 0):
    print('No')
    sys.exit()

N1 = int((len(S)-1) / 2)
N3 = int((len(S)+3) / 2)

sl = []
nl = []
for i in range(N1):
    sl.append(S[i])

for j in range(N3-1, len(S)):
    nl.append(S[j])

moji1= ''
for x in sl:
    moji1 = moji1+ x

moji2 = ''
for x in nl:
    moji2 = moji2 + x

remoji1 = list(reversed(moji1))
remoji2 = list(reversed(moji2))

res = list(reversed(S))

if moji1 == ''.join(remoji1) and moji2 == ''.join(remoji2) and S == ''.join(res):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
a = S[0:(N-1)//2]
b = S[(N+3)//2-1:]


def k(a):
    for i in range(len(a)):
        if a[i] != a[len(a)-1-i]:
            return False
    else:
        return True

if k(S) & k(a) & k(b):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
halfS = S[:len(S)//2]

ans = 'No'
if S == S[::-1]:
    if halfS == halfS[::-1]:
        ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
s = input()

def check(s):
  if len(s) == 1 or len(s) == 0:
    return True
  if s[0]!=s[-1]:
    return False
  return check(s[1:-1])

mid = len(s)//2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
halfS=str(S[0:int(len(S)/2)])
ans="No"
if S==S[::-1]:
    if halfS==halfS[::-1]:
        ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
def is_palindrome(s):
    i = 0
    j = len(s)-1
    flag = 1
    while(i<j):
        if s[i] != s[j]:
            flag = 0
            break
        i = i + 1
        j = j - 1
    return(flag)

s = input()
n = len(s)
f1 = int(((n+1)/2) - 1)
f2 = int((n+3)/2 - 1)

if is_palindrome(s) and is_palindrome(s[:f1]) and is_palindrome(s[f2:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
s = input()
n = len(s)
def check(string):
    flag = 1
    l = len(string)
    for i in range(l):
        if string[i] != string[-i-1]:
            flag = 0
            break
    return flag

if check(s):
    if check(s[:(n-1)//2]):
        if check(s[-1+(n+3)//2:]):
            print('Yes')
            sys.exit()
print('No')

Submission status: Accepted

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

def is_palindrome(s):
    n = len(s)
    i, j = 0, n-1
    while i < j:
        if s[i] != s[j]:
            return False
        else:
            i += 1
            j -= 1
    return True

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s= str(input())
if s != s[::-1]:
    print("No")
    exit()
else:
    s1 = s[:len(s)//2]
    s2 = s[len(s)//2+1:]
    if (s1!=s2):
        print("No")
    else:
        print("Yes")

Submission status: Accepted

Solution code:
def check(a):
    i=0
    j=len(a)-1
    b=True
    while(i<=j):
        if(a[i]!=a[j]):
            return False
        i+=1;
        j-=1
    return b


a=(input())
b=a[:(len(a)-1)//2:]
c=a[(len(a)+2)//2::]
#print(a,b,c)
if(check(a)==True and check(b)==True and check(c)==True):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = str(input())
if s != s[::-1]:
  print("No")
  exit()
else:
  s2 = s[:len(s)//2]
  s3 = s[len(s)//2+1:]
  if s2 != s3:
    print("No")
  else:
    print("Yes")

Submission status: Accepted

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

#sys.setrecursionlimit(10**9)

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
#import numpy as np

from collections import deque

def main():
	s=input().rstrip()
	ans="Yes"
	n=len(s)
	for i in range(n):
		if s[i]!=s[-i-1]:
			ans="No"
	for i in range(n//2):
		if s[i]!=s[n//2-i-1]:
			ans="No"
	print(ans)





if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
S=input()
ans="Yes"
if all(a==b for a,b in zip(S,reversed(S))):
    if all(a==b for a,b in zip(S,reversed(S[:len(S)//2]))):
            pass
    else:
        ans="No"
else:
    ans="No"
print(ans)

Submission status: Accepted

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

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

S_before = []
S_before = S[0:int(((N-1)/2))]
#print(S_before)
S_after = []
S_after = S[int(((N+3)/2)-1):N]
#print(S_after)

if palindrome(S) + palindrome(S_after) + palindrome(S_before)==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S = input()
N = len(S)

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

Submission status: Accepted

Solution code:
def resolve():
    S = str(input())
    S_size = len(S)
    S_reverse = S[::-1]
    count = (S_size - 1) / 2
    next_s = S[0:int(count)]
    extt2_s = S[int((S_size + 3) / 2)::S_size]

    if S == S_reverse and next_s == next_s[::-1] and extt2_s == extt2_s[::-1]:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
list = list(x)
list_num = len(x)

former_num = (list_num - 1) // 2
later_num =  (list_num + 3) // 2

if list[:former_num] == list[later_num-1:list_num]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = [i for i in input()]
len_s = len(s)

def reverse(s):
  rev = [j for j in s[::-1]]
  return rev

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
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
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
N = len(S)
S2 = S[:N//2]
S3 = S[(N+3)//2-1:]

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
a = S[0:(N-1)//2]
b = S[(N+1)//2:N]

def inv(str):
  return str[::-1]

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
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
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

S = input()
T = S[:len(S)//2]
U = S[len(S)//2+1:]
c = 3

def kaibun(L, c):
  for i in range(len(L)//2):
    if L[i] != L[-(i+1)]:
      c -= 1
      print("No")
      exit()
      
kaibun(S, c)
kaibun(T, c)
kaibun(U, c)

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

Submission status: Accepted

Solution code:
S = str(input())
N = len(S)
#print(N)
flag = True
if S == S[::-1]:
    n1 = int((N-1)/2)
    S1 = S[:n1]
    #print(S1)
    if S1 == S1[::-1]:
        n2 = int((N+3)/2)
        S2 = S[n2-1:]
        #print(S2)
        if S2 == S2[::-1]:
            print("Yes")
            flag = False
if flag:
    print("No")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
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
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()
T = S[:len(S)//2]
U = S[len(S)//2+1:]

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

Submission status: Accepted

Solution code:
S = str(input())

N = len(S)

ans = "Yes"
for i in range(N):
  if S[i] != S[N-1-i]:
    ans = "No"
    break
N_1 = int((N-1)/2)
for i in range(N_1):
  if S[i] != S[N_1-1-i]:
    ans = "No"
    break
N_2 = int((N+1)/2)
for i in range(N_1):
  if S[N_2+i] != S[N-1-i]:
    ans = "No"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
front=""
back=""
for i in range(int((N-1)/2)):
  front+=S[i]
i=(N+3)/2
for i in range(int((N+3)/2)-1,N):
  back+=S[i]
print("Yes") if front==back else print("No")

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    n=len(S)
    # eprint('S[0:(n-1)//2] , S[0:(n-1)//2][::-1] , S[(n+3)//2 - 1:n] , S[(n+3)//2 - 1:n][::-1] ',end=':\n')
    # eprint(S[0:(n-1)//2] , S[0:(n-1)//2][::-1] , S[(n+3)//2 - 1:n] , S[(n+3)//2 - 1:n][::-1])
    if S[0:(n-1)//2] == S[0:(n-1)//2][::-1] == S[(n+3)//2 - 1:n] == S[(n+3)//2 - 1:n][::-1]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
c = (n - 1) // 2
s_reversed = s[::-1]
if s != s_reversed:
    print('No')
else:
    s_former = s[0:c]
    sf_reversed = s_former[::-1]
    s_later = s[c + 1:]
    sl_reversed = s_later[::-1]
    if s_former == sf_reversed and s_later == sl_reversed:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
def kaibun(str):
    if str != str[::-1]:
        return False
    str2 = str[:(n-1)//2]
    if str2 != str2[::-1]:
        return False
    str3 = str[(n+3)//2-1:]
    if str3 != str3[::-1]:
        return False
    return True

str = input()
n = len(str)
print('Yes' if kaibun(str) else 'No')

Submission status: Accepted

Solution code:
S = list(str(input()))
N = len(S)
a = 0
newS = list(reversed(S))
if S == newS:
        a += 1

left = []
for i in range(0,int((N-1)/2)): #(N-1)/2までが回文か確認
  left += S[i]
newleft = list(reversed(left))
if left == newleft:
        a += 1

right = []
for i in range(0,int((N-1)/2)): #(N+3)/2までが回文か確認
  right += S[-i-1]
newright = list(reversed(right))
if right == newright:
        a += 1
    
if a == 3:
	print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
input_ = input()
length = int(len(input_))
if length%2==0:
  print('No')
  exit(0)

f,b = input_[:int((length-1)/2)],input_[int((length-1/2)):]
str_ = [input_,f,b]

for s in str_:
  #print(s)
  if s==''.join(list(reversed(s))): pass
  else:
    print('No')
    exit(0)
print('Yes')

Submission status: Accepted

Solution code:
string = input()
n = len(string)
ln1 = (n - 1) // 2
ln2 = (n + 3) // 2
per = False
if string == string[::-1]:
    if string[:ln1] == string[:ln1][::-1]:
        s1 = string[:ln1]
        s2 = string[:ln1][::-1]
        s3 = string[ln2 - 1:]
        s4 = string[ln2 - 1:][::-1]
        if string[ln2 - 1:] == string[ln2 - 1:][::-1]:
            per = True
if per is True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

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

N = len(S)

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

Submission status: Accepted

Solution code:
S = input()
N = int(len(S))
a = 0
for i in range(0,int((N-1)/2)):
    if S[i] == S[-i-1]:
        a += 1
        
left = []
for i in range(0,int((N-1)/2)):
  left += S[i]
for i in range(0,int((N-1)/4)):
    if left[i] == left[-i-1]:
        a += 1

right = []
for i in range(0,int((N-1)/2)):
  right += S[-i-1]
for i in range(0,int((N-1)/4)):
    if right[i] == right[-i-1]:
        a += 1

if a == int((N-1)/2) + int((N-1)//4 * 2):
	print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
for i in range(n//2):
  if not (s[i] == s[n//2-i-1] == s[n//2+1+i] == s[n-1-i]):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

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

check=True

for i in range( (N-1)//2 ):
    if S[i]!=S[N-1-i]:
        check=False

S_sub1 = S[0:(N-1)//2]
N1=len(S_sub1)
if N1%2==1:
    for i in range( (N1-1)//2 ):
        if S_sub1[i]!=S[N1-1-i]:
            check=False
else:
    for i in range( N1//2 ):
        if S_sub1[i]!=S[N1-1-i]:
            check=False

S_sub2 = S[ (N+3)//2-1:N]
N2=len(S_sub2)
if N2%2==1:
    for i in range( (N2-1)//2 ):
        if S_sub2[i]!=S[N2-1-i]:
            check=False
else:
    for i in range( N2//2 ):
        if S_sub2[i]!=S[N2-1-i]:
            check=False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = ""
S = input()
reversed_S = ""
for i in reversed(range(len(S))):
    reversed_S += S[i]

if S == reversed_S:
    half_S = len(S)//2
    first_half_S = S[:half_S]
    reversed_f_S = ""
    for i in reversed(range(len(first_half_S))):
        reversed_f_S += first_half_S[i]

    second_half_S = S[half_S+1:]
    reversed_s_S = ""
    for i in reversed(range(len(second_half_S))):
        reversed_s_S += second_half_S[i]

    if first_half_S == reversed_f_S and second_half_S == reversed_s_S:
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"

print(ans)

Submission status: Accepted

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

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

N1=len(S1)
N2=len(S2)

for i in range(int(N//2)):
    if S[i] != S[N-i-1]:
        break
else:
    S = 'Palindrome'
    

for i in range(int(N1/2)):
    if S1[i] != S1[N1-i-1]:
       # print('No')
        break
else:
    S1 = 'Palindrome'
   

for i in range(int(N2/2)):
    if S2[i] != S2[N2-i-1]:
        #print('No')
        break  
else:
    S2 = 'Palindrome'
   

if (S == 'Palindrome' and S1 == 'Palindrome' and S2 == 'Palindrome'):
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

S = input("")
S_list = list(S)
N = len(S_list)
N = int(N)
k_0 = 0
k_1 = 0
k_2 = 0
a = math.floor((N-1)/2)
b = math.floor((N-3)/4)
c = math.floor((N+1)/2)

for i in range(a):
    if S_list[i] != S_list[N-i-1]:
        k_0 += 1


if N>5:
    for i in range(b):
        if S_list[i] != S_list[a-i-1]:
            k_1 += 1
elif N == 5:
    if S_list[0] != S_list[1]:
            k_1 += 1


if N>5:
    for i in range(b):
        if S_list[c+i] != S_list[N-i-1]:
            k_2 += 1
elif N == 5:
    if S_list[0] != S_list[1]:
            k_2 += 1

#print(k_0, k_1, k_2)
if k_0==0 and k_1==0 and k_2==0:
    print("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
def kaibun(S):
    N = len(S)
    harf = int(N / 2)
    if harf != 0:
        a = S[:harf]
        b = S[-harf:][::-1]
    else:
        a = S[:1]
        b = S[-1:][::-1]
    return a,b

S = input()
flag = 0
a,b = kaibun(S)
if a == b:
    a1,a2 = kaibun(a)
    if a1 == a2:
        b1,b2 = kaibun(b)
        if b1 == b2:
            flag = 0
        else:
            flag = 1
    else:
        flag = 1
else:
    flag = 1

if flag == 0:
    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:]


reversed_s = list(reversed(list(s)))
reversed_s1 = list(reversed(list(s1)))
reversed_s2 = list(reversed(list(s2)))


if s == ''.join(reversed_s) and s1 == ''.join(reversed_s1) and s2 == ''.join(reversed_s2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

def is_pal(s):
    if(s==s[::-1]):
        return True
    else:
        return False
        
s=input()
if is_pal(s):
    n=len(s)//2
    if is_pal(s[0:n]) and is_pal(s[n+1:]):
        print("Yes")
    else:
        print("No")
    
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
s = input()
n = len(s)
l = (n - 1) // 2
s1 = s[:l]
s2 = s[l+1:][::-1]
if s1 != s2:
    print('No')
    sys.exit()
if s1 != s1[::-1] or s2 != s2[::-1]:
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
s = input()
n = len(s)
l = (n - 1) // 2
s1 = s[:l]
s2 = s[l+1:][::-1]
if s1 != s2:
    print('No')
    sys.exit()
m = l // 2
if l % 2 == 0:
    a1 = s1[:m]
    b1 = s2[:m]
    a2 = s1[m:][::-1]
    b2 = s2[m:][::-1]
else:
    a1 = s1[:m]
    b1 = s2[:m]
    a2 = s1[m+1:][::-1]
    b2 = s2[m+1:][::-1]
if a1 != a2 or b1 != b2:
    print('No')
    sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
import numpy as np

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

def main():
    args = input().rstrip().split(' ')
    S = np.array([c for c in args[0]])
    l = len(S)
    s1 = np.array([S[i] for i in range(0, int(l/2))])
    s2 = np.array([S[i] for i in range(int(l/2)+1, l)])
    if(judge(S) and judge(s1) and judge(s2)):
        print('Yes')
    else:
        print('No')
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

s = input()
srev = s[::-1]
subs = s[:(len(s)-1)//2]
subsrev = subs[::-1]
subs2 = s[(len(s)+3)//2-1:len(s)]
subs2rev = subs2[::-1]

for i in range(len(s)):
    if s[i] != srev[i]:
        print('No')
        exit(0)
for i in range(len(subs)):
    if subs[i] != subsrev[i]:
        print('No')
        exit(0)
for i in range(len(subs2)):
    if subs2[i] != subs2rev[i]:
        print('No')
        exit(0)
print('Yes')