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)

cnt = 0
for i in range(0,N):
	if not S[i] == S[N-1-i]:
		cnt = 1

for i in range(0,(N-1)//2):
	if not S[i] == S[(N-1)//2-1-i]:
		cnt = 1
	
for i in range((N+3)//2,(N-1)//2):
	if not S[i] == S[(N+3)//2-1-i]:
		cnt = 1
		
if cnt == 1:
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
s=input()

def judge_palindrome(x):
	if x==x[::-1]:
		return True
	else:
		return False

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

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
ok = False
if S != list(reversed(S)):
    print("No")
elif S[: N // 2] == list(reversed(S[: N // 2])):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


def check_kaibun(kaibun):
    n = len(kaibun)
    middle = n // 2
    count = 0
    for i in range(middle):
        if kaibun[i] == kaibun[n - i - 1]:
            count += 1
        else:
            count = 0
            break
    if count == middle:
        return True
    else: 
        return False


left_center = (l-2) // 2
right_center = (l+2) // 2

check0 = check_kaibun(s)
check1 = check_kaibun(s[:left_center + 1])
check2 = check_kaibun(s[right_center:])

if (check0 == True) and (check1 == True) and (check2 == True): 
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

n = len(s)
mid = int((n - 1)/2)
r = s[::-1]

for i in range(mid):
    if s[i] != r[i] or s[i] != s[mid-i-1] or r[i] != r[mid-i-1]:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
def nyu():
    S= list(map(str,(input())))
    return S


def check(S ):
    Strong_str1 = ""
    Strong_str2 = ""
    Strong_str3 = ""

    for s in range(int(len(S)/2)):
        Strong_str1 += S[s]

    for s in range(int((len(S)+3)/2-1),len(S)):
        Strong_str2 += S[s]

    Strong_str3 = S[::-1]

    # print(Strong_str1)
    # print(Strong_str2)
    # print(Strong_str3)

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


            
S = nyu()
check(S)
#print(S)

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 pala(s):
  pr=s[::-1]
  if s==pr:
    return True
  else:
    return False

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

Submission status: Accepted

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

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

if (s==s[::-1]) and (a==a[::-1]) and (b==b[::-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]
def kaibun(x):
    ret=1
    for i in range(len(x)//2):
        if x[len(x)-1-i]!=x[i]:
            ret=0
            break
    return ret
if kaibun(s)+kaibun(s1)+kaibun(s2)==3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def if_kai(s):
    n = len(s)
    l = 0
    r = n-1
    while(l<n//2):
        if s[l]!=s[r]:
            return 0
        l+=1
        r-=1
    return 1



s = input()
n = len(s)
if not if_kai(s):
    print('No')
    exit()
f = 1
l = 0
r = ((n-1)//2)-1
while(l<r):
    if s[l]!=s[r]:
        print('No')
        exit()
    l+=1
    r-=1
l = ((n+3)//2)-1
r = n-1
while(l<r):
    if s[l]!=s[r]:
        print('No')
        exit()
    l+=1
    r-=1
print('Yes')

Submission status: Accepted

Solution code:
s = input()
answer = "Yes"
for n in range(int((len(s)-1)/2)):
    if s[n] != s[-(n+1)]:
        answer = "No"
if len(s) % 4 == 1:
    for n in range(int((len(s)-1)/4)):
        if s[n] != s[int((len(s)-1)/2-1-n)]:
            answer = "No"
if len(s) % 4 == 3:
    for n in range(int((len(s)-3)/4)):
        if s[n] != s[int((len(s)-1)/2-1-n)]:
            answer = "No"
print(answer)

Submission status: Accepted

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

s_reverse = s[::-1]

s1 = s[::int((n-1)/2)]
s1_reverse = s1[::-1]

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

if (s==s_reverse) and (s1==s1_reverse) and (s2==s2_reverse):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin


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


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    N = len(S)
    flag = True
    if flag:
        flag = judge_palindrome(S)
    if flag:
        flag = judge_palindrome(S[0:(N-1)//2])
    if flag:
        flag = judge_palindrome(S[(N+3)//2-1:N])
    TF = 'Yes' if flag else 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)

Submission status: Accepted

Solution code:
s = input()

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



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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
judge = True
for i in range(len(S)//2):
    if S[i] != S[len(S) - i - 1]:
        judge = False
        break


if judge:        
    for i in range(int((len(S)-1)/2)):
  
        if S[i] != S[int((len(S)-1)/2)- 1 - i]:
            judge = False
            break
        elif S[int((N+3)/2)-1 + i] != S[N-1-i]:
            judge = False
            break

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

Submission status: Accepted

Solution code:
S = input()

reversedS = S[::-1]

str1 = S[:int((len(S)-1)/2)]
reversedStr1 = str1[::-1]

str2 = S[int((len(S)+3)/2)-1:]
reversedStr2 = str2[::-1]

flag = False
if S == reversedS:
  if str1 == reversedStr1:
    if str2 == reversedStr2:
      print('Yes')
      flag = True
      
if flag == False:
  print('No')

Submission status: Accepted

Solution code:
def is_palindrome(S):
    pal = True
    for i in range(len(S)//2):
            if S[i] != S[len(S)-1-i]:
                pal = False
    return pal
def main():
    S = input()
    l = S[:len(S)//2]
    r = S[len(S)//2+1:]
    if is_palindrome(S) and is_palindrome(l) and is_palindrome(r):
        print("Yes")
    else:
        print("No")
main()

Submission status: Accepted

Solution code:
import math
S=input()
N=len(S)
#mid=math.ceil(N/2)

firstS=S[:math.ceil(N/2)-1]
secondS=S[int((N+3)/2-1):]

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

Submission status: Accepted

Solution code:
import sys
s = input()
n = len(s)
for i in range(int((n-1)/2)):
    if s[i] != s[-1-i]:
        print("No")
        sys.exit()
second = s[0:int((n-1)/2)]
for i in range (int(len(second)/2)):
    if second[i] != second[-1-i]:
        print("No")
        sys.exit()
third = s[int((n+3)/2):n-1]
for i in range (int(len(third)/2)):
    if third[i] != third[-1-i]:
        print("No")
        sys.exit()
        
print("Yes")

Submission status: Accepted

Solution code:
s = input()

cnt = 0
for i in range(0,len(s)):
    if s[i] != s[len(s)-1-i]: cnt += 1
    else: pass

test2 = int((len(s)-1)/2)
for i in range(0,test2):
    if s[i] != s[test2-1-i]: cnt += 1
    else: pass
    
test3 = int((len(s)+3)/2-1)
for i in range(test3,len(s)):
    if s[i] != s[len(s)-1-i]: cnt += 1
    else: pass
    
if cnt != 0: 
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys

S = list(input())

for i in range(0, len(S)//2, 1):
    if S[i]!=S[-(i+1)]:
        print("No")
        sys.exit()

#左半分
A = S[0:(len(S)-1)//2]
for i in range(0, len(A), 1):
    if A[i]!=A[-(i+1)]:
        print("No")
        sys.exit()

#右半分
A = S[((len(S)+3)//2)-1:]
for i in range(0, len(A), 1):
    if A[i]!=A[-(i+1)]:
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
S=input()
N=len(S)
ans='Yes'

for i in range((N-1)//2):
    if S[i] != S[N-i-1]:
        ans='No'

if int((N-1)/2)%2==1:
    for i in range((N-3)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
else:
    for i in range((N-1)//4):
        if S[i] != S[((N-3)//2)-i] or S[((N+1)//2)+i] != S[N-i-1]:
            ans='No'
 
print(ans)

Submission status: Accepted

Solution code:
import math
org_str=input()
new_str = org_str[::-1]
if(new_str==org_str):
  org_str2=org_str[0:math.ceil((len(org_str)-1)/2)]
  new_str2=org_str2[::-1]
  if(new_str2==org_str2):
    org_str3=org_str[math.ceil((len(org_str)+3)/2):-1]
    new_str3=org_str3[::-1]
    if(new_str3==org_str3):
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
l = len(s)
s1 = s[:int((l-1)/2)]
s3 = s[int((l+1)/2):]
s4 = s3[::-1]

m = s[:int((l-1)/2)]
n = len(m)
m1 = m[:int((n)/2)]
m3 = m[int((n+1)/2):]
m4 = m3[::-1]

a = s[int((l+3)/2-1):]
b = len(a)
a1 = a[:int((b-1)/2)]
a3 = a[int((b+1)/2):]
a4 = a3[::-1]


if (s1 in s4) & (m1 in m4) & (a1 in a4):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

length = len(S)
is_strong_palindrome = True

for i in range(length//2):
    if S[i] != S[length-i-1]:
        is_strong_palindrome = False
        break

first_half_S = S[:length//2]
second_half_S = S[length//2+1:]
# print(first_half_S)
# print(second_half_S)

length_palindrome = len(first_half_S)
for i in range(length_palindrome//2):
    if first_half_S[i] != first_half_S[length_palindrome-i-1]:
        is_strong_palindrome = False
        break
    if second_half_S[i] != second_half_S[length_palindrome-i-1]:
        is_strong_palindrome = False
        break

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

Submission status: Accepted

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

S = input()
N = len(S)
ans = 'Yes'
if kaibun(S):
  pass
else:
  ans = ('No')
if kaibun(S[:(N-1)//2]):
  pass
else:
  ans = ('No')
if kaibun(S[:(-(N-1)//2)-1:-1]):
  pass
else:
  ans = ('No')
print(ans)

Submission status: Accepted

Solution code:
s = input()
slen = len(s)
left = s[0: int((slen-1)/2)]
right = s[int((slen+1)/2): slen]
if s != s[::-1]:
    print('No')
elif left != left[::-1]:
    print('No')
elif right != right[::-1]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = str(input())

N = len(S)
palinBool = "No"

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

print(palinBool)

Submission status: Accepted

Solution code:
def reverse(x):
  if x[::-1]==x:
    return True
  else:
    return False

def main(s):
  l=len(s)//2
  x1=s[:l]
  x2=s[l+1:]
  if reverse(s) and reverse(x1) and reverse(x2):
    print("Yes")
  else:
    print("No")
    
if __name__=='__main__':
  main(input())

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

S = list(input())
N = len(S)
A = S[:(N-1)//2]
B = S[(N-1)//2+1:]

def kaibun(l):
    n = len(l)
    for i in range(max(n//2-1,1)):
        if l[i] != l[n-1-i]:
            return False
    return True
if kaibun(S) and kaibun(A) and kaibun(B):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
s1 = s[:int((n-1)/2)]
if s != s[::-1] or s1 != s1[::-1]:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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


for i in range((n-1)//2):
    if s[i]==s[n-1-i]==s[((n-1)//2)-1-i]:
        flag=flag+1

if flag==((n-1)//2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s1=s[(n+3)//2-1:]
for i in range(len(s1)//2):
    if(s1[i]!=s1[-1-i]):
        flag=1
        break

for i in range(n//2):
    if s[i]!=s[-1-i]:
        flag=1
        break

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

Submission status: Accepted

Solution code:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    S = input(str)
    th = (len(S) - 1) // 2
    a = S
    b = S[:th]
    c = S[th+1:]
    yesno(a == a[::-1]
          and b == b[::-1]
          and c == c[::-1])


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

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

#print(s1,flag)
#print(len(s1))
s1=s[(n+3)//2-1:]
for i in range(len(s1)//2):
  if (s1[i]!=s1[-1-i]):
    flag=1
    break
#print(len(s1))
#print(s1,flag)

for i in range(n//2):
  if s[i]!=s[-1-i]:
    flag=1
    break
if flag==1:
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    def check_palindrome(s):
        n = len(s)
        i = 0
        while i < (n - 1 - i):
            if s[i] != s[n - 1 - i]:
                return False
            i += 1
        return True
    
    s = input()
    n = len(s)
    left = s[:(n-1)//2]
    right = s[(n+3)//2 - 1:]
    print('Yes') if check_palindrome(left) and check_palindrome(right) and check_palindrome(s) else print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	S = input()
	N = len(S)
	judge = "Yes"
	s = int((N - 3) // 2)
	t = int((N + 1) // 2)
	for i in range(int((N - 1) // 2)):
		if S[i] != S[s - i]:
			judge = "No"
		if S[t + i] != S[N - 1 - i]:
			judge = "No"

	for i in range(N):
		if S[i] != S[N - 1 - i]:
			judge = "No"

	print(judge)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
s = input()

flag = True
n = len(s)
for i in range(n//4):
  if s[i] == s[(n-1)//2 -1 - i] == s[(n+3)//2 -1 + i] == s[n-1 - i]:
    if (n//2) % 2 == 1:
      if s[n//4] != s[n-1 - n//4]:
        flag = False
        break
      else:
        continue
    else:
      continue
  else:
    flag = False
    break

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

Submission status: Accepted

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

S_rev1 = S[::-1]
S_rev2 = S2[::-1]
S_rev3 = S3[::-1]

if S == S_rev1 and S2 == S_rev2 and S3 == S_rev3 :
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

n = len(s)

def is_palindrome(start, end):
    while start <= end:
        if s[start] == s[end]:
            start += 1
            end -= 1
        else:
            return False
    return True

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

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc159/tasks/abc159_b"

def main():
    ans = 'Yes'
    S = input()
    if S != S[::-1]:
        ans = 'No'

    t = S[0:(len(S) - 1) // 2]
    if t[::-1] != t:
        ans = 'No'

    t = S[(len(S) + 2) // 2:len(S)]
    if t[::-1] != t:
        ans = 'No'

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
s = len(S)
L = []
A = ""
for i in S[:int((s-1)/2)]:
    L.append(i)
    A += i
    
A = A[::-1]
#print(A)

B = ""
for i in S[int((s+1)/2):]:
    B += i
    
B = B[::-1]
#print(B)

if S == S[::-1] and A == S[:int((s-1)/2)] and B == S[int((s+1)/2):]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#my_string = input("Type your word: ")
my_string = input()
my_string = my_string.casefold()
if ((len(my_string)) < 3 or (len(my_string)) > 100):
    #print(len(my_string))
    print("No")
    quit()

reversed_string = reversed(my_string)

n = len(my_string)
#defining string [0:(n-1)/2]
first_chars = my_string[:int((n-1)/2)]
reversed_first_chars = reversed(first_chars)

#defining string [((n+3)/2):n-1]
last_chars = my_string[int((n+3)/2)-1:]
reversed_last_chars = reversed(last_chars)
#print(type(first_chars), first_chars)
#print(last_chars)
#print(n)

#checking if S is a palindrome
if list(my_string) == list(reversed_string):
    #checking if it is a strong palindrome
    if (list(first_chars) == list(reversed_first_chars)):
        if (list(last_chars) == list(reversed_last_chars)):
            print("Yes")
        else:
            print("No")
    else:
        print("No")
#if it is not a palindrome at all
else:
    print("No")

Submission status: Accepted

Solution code:
import math
S=input()
N=len(S)
K=math.floor((N-1)/2)
R=math.floor((N+3)/2)

if S[0]==S[K-1] and S[R-1]==S[N-1] and S==S[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
str = input()
f = ((len(str)-1)//2)
s = ((len(str)+3)//2)
rf=str[:f]
fr=rf[::-1]
sf=str[s-1:]
fs=sf[::-1]
if str[::-1] == str and str[:f]  == fr and str[s-1: ] == fs:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = list(input())

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
l = len(S)
i = 0

while i < (l-1)/2:
    if S[i] != S[-i-1] or S[i] != S[int((l-1)/2)-i-1]:
        print('No')
        break
    i = i + 1
else:
    print('Yes')

Submission status: Accepted

Solution code:
##======================================python3
import sys
import collections
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

class Run:
    def build(gv):
        gv.s = input().strip()
    
    def string_reverse_chk(gv, s:str):
        rev_s = "".join(list(reversed(s))[0:len(s)])
        if s == rev_s:
            return True
        return False
    
    def solve(gv):
        
        ans = "No"
        
        while True:
            slen = len(gv.s)
            reversed_s = "".join(list(reversed(gv.s))[0:slen])
            
            if gv.string_reverse_chk(gv.s) is False : break
            if gv.string_reverse_chk(gv.s[0:int((slen -1)/2)]) is False : break
            if gv.string_reverse_chk(reversed_s[0:int((slen -1)/2)]) is False : break
            
            if gv.string_reverse_chk(gv.s[int((slen +3)/2 -1):slen]) is False : break
            if gv.string_reverse_chk(reversed_s[int((slen +3)/2 -1):slen]) is False : break
            
            
            ans = "Yes"
            break
        
        print(ans)
        
if __name__ == '__main__':
    run = Run()
    run.build()
    run.solve()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
x=(n-1)//2
i=0
while i<x:
  if s[i]!=s[n-1-i] or s[i]!=s[x-1-i]:
    print('No')
    break 
  i=i+1
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()


def main():
    judge = True

    for i in range(len(S)):
        # print("{} {}".format(S[i], S[-(i+1)]))
        if S[i] != S[-(i+1)]:
            # print("NO:{} {}".format(S[i],S[-i]))
            judge = False

    if S[0:int((len(S)-1)/2)] != S[int((len(S)+3)/2)-1:len(S)]:
        # print(S[0:int((len(S)-1)/2)])
        # print(int((len(S)-1)/2))
        # print(S[int((len(S)+3)/2)-1:len(S)])
        # print(int((len(S)+3)/2))
        judge = False


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    *S, = map(str, open(0).read().split())
    S = S[0]
    S_re = S[::-1]
    N = len(S)
    S_s1 = S[:(N-1)//2]
    S_s2 = S[(N+2)//2:]

    if (S == S_re
        and S_s1 == S_s1[::-1]
        and S_s2 == S_s2[::-1]):
        print('Yes')
    else:
        print('No')


main()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
x=(n-1)//2
y=(n+1)//2
for i in range(x):
    if s[i]!=s[n-i-1] or s[i+y]!=s[n-i-1] or s[i]!=s[x-i-1]:
        print("No")
        break
else: print("Yes")

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *

from itertools import *
from decimal import *
import copy
from bisect import *
import time

import math

def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
sys.setrecursionlimit(10**7)
input=lambda :sys.stdin.readline().rstrip()
S=input()
N=len(S)
for i in range(N//2):
    if S[i]!=S[-1-i]:
        print("No")
        exit()
for i in range(0,(N-1)//2):
    if S[i]!=S[(N-1)//2-1-i]:
        print("No")
        exit()

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

Submission status: Accepted

Solution code:
s = input()
# s = 'igyojknviataivnkjoygizigyojknviaaaivnkjoygi'
n= len(s)

tmp1 =s[:int((n-1)/2)]
tmp2 =s[int((n+3)/2)-1:]


flg = True

for i in range(0, int(len(tmp1)/2)):
    if tmp1[i] != tmp1[len(tmp1)-1-i]:
        flg = False

for i in range(0, int(len(tmp2)/2)):
    if tmp2[i] != tmp2[len(tmp2)-1-i]:
        flg = False

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

if flg == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def check(string):
    if string==string[::-1]:
        return True
    else:
        return False

ans = 'No'

if check(S):
    if check(S[0:(N-1)//2]):
        if check(S[(N+3)//2-1:N]):
            ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
S= list(stdin.readline().strip())
N=len(S)
left=0
right=N-1
midle_right=(N-2)//2
midle_left=(N+2)//2
while(right!=left):
    if S[left]!=S[right]:
        print("No")
        exit()
    if S[left]!=S[midle_right]:
        print("No")
        exit()
    if S[right]!=S[midle_right]:
        print("No")
        exit()
    midle_right-=1
    midle_left+=1
    if right==midle_right:
        midle_right=right-1
    if left==midle_left:
        midle_left=left+1
    left += 1
    right -= 1
print("Yes")

Submission status: Accepted

Solution code:
s = list(input())
s_f = s[0: (len(s) - 1) // 2]
s_b = s[(len(s) + 3) // 2 - 1:len(s)]

if (s != s[::-1]) or (s_f != s_f[::-1]) or (s_b != s_b[::-1]):
    print('No')
else:
    print('Yes')

Submission status: Accepted

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


string = input()
n = len(string)
n-=1
str1 = string[0:int((n)/2)]
# print(str1)
str2 = string[int((n)/2)+1:n+1]
# print(str2)
if check(str1) and check(str2) and check(string):
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

flag=True

for i in range((n-1)//2+1):
    if s[i]==s[n-i-1]:
        flag=True
    else:
        flag=False
        break
if flag:
    for j in range((len(l)-1)//2+1):
        if l[j]==l[len(l)-j-1] and r[j]==r[len(l)-j-1]:
            flag=True
        else:
            flag=False
            break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = "Yes"

for i in range(n//2):
    if s[i] == s[n - i - 1]:
        continue
    else:
        ans = "No"
for i in range(n//2):
    if s[i] == s[n//2 - i - 1]:
        continue
    else:
        ans = "No"

print(ans)

Submission status: Accepted

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

s1 = S[:int(N/2)]
s2 = S[int(N/2)+1:N+1]

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

Submission status: Accepted

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

ans = True
for j in range(3):
    for i in range(1,N//2 +1):
        if S[i-1] != S[N- i]:
            ans = False
            break
    if j ==0:
        S1 = S[:(N-1)//2]
        S2 = S[(N-1)//2+1:]
        S =S1
    elif j==1:
        S =S2

    N =len(S) 
            
if ans==True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = input()
n = len(s)

pivot = (n - 1) //2
pre = s[:pivot]
post = s[pivot+1:]

if pre == post and is_kaibun(pre) and is_kaibun(post):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#  回文 + 何か1文字 + 回文 なら強い回文
def judge(s):
    flag = True
    for i in range(len(s)):
        if s[i] != s[len(s)-i-1]:
            flag = False
    return flag


S = input()
left = S[:(len(S)-1)//2]
right = S[(len(S)-1)//2+1:]

if judge(left) and judge(right) and judge(S):
    print("Yes")
else:
    print("No")

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) and kaibun(s[:(n-1)//2]) and kaibun(s[(n+1)//2:])==True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if s[:(n-1)//2] != s[(n+1)//2:] or s[:(n-1)//2] != s[(n-3)//2::-1]:
  ans='No'

print(ans)

Submission status: Accepted

Solution code:
S = list(input())

ans = S == list(reversed(S))
ans &= S[:(len(S)-1)//2] == list(reversed(S[:(len(S)-1)//2])) 
ans &= S[((len(S)+3)//2)-1:] == list(reversed(S[((len(S)+3)//2)-1:])) 

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