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()

def isPalin(s):
    flag = True
    for i in range(len(s)):
        if s[i] != s[-i-1]:
            flag = False
            break
    return flag

if isPalin(S) and isPalin(S[:(len(S)-1)//2]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
def f(a:str): #回文
  l = len(a)
  m = l // 2
  for i in range(m):
    if a[i] != a[l-i-1]:
      return False
  else:
    return True
if f(S) and f(S[:(N-1)//2]) and f(S[(N+1)//2:]):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

t = s[0:(n-1)//2]
l = s[1+(n-1)//2::]

flag = 1
for i in range(len(t)//2):
  if t[i] != t[-i-1]:
    flag = 0

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

Submission status: Accepted

Solution code:
s = input()
l = len(s)
s1 = s[:(l - 1) // 2]
s2 = s[(l + 2) // 2:]
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="Yes"
for i in range(n//2):
    if s[i]!=s[n-1-i]:
        ans="No"
for j in range(n//2):
    if s[i]!=s[n//2-1-i]:
        ans="No"
for j in range(n//2):
    if s[n//2+1+i]!=s[-1-i]:
        ans="No"


print(ans)

Submission status: Accepted

Solution code:
S = input()

N = len(S)
halfN = int((N-1)/2)

Ans = 'Yes'

for indx in range(halfN):
    if S[indx] != S[(N-1)-indx]:
        Ans = 'No'

if Ans == 'No':
    print(Ans)
else:
    for halfIndx in range(int(halfN/2)):
        if S[halfIndx] != S[(halfN-1) - halfIndx]:
            Ans = 'No'
    print(Ans)

Submission status: Accepted

Solution code:
S = input()

Kugiri = len(S) // 2
if S == ''.join(list(reversed(S))):
    up = ''
    down = ''
    for i in range(0, Kugiri):
        up += S[i]
    for q in range(Kugiri + 1, len(S)):
        down += S[q]
    if up == ''.join(list(reversed(up))) and down == ''.join(list(reversed(down))):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    N = len(S)
    L1 = (N-1)//2
    L2 = (N+3)//2

    if S[0:L1] == S[L2-1:N]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
s = input()
s1 = s[:int((len(s)-1)/2)]
s2 = s[int((len(s)+3)/2-1):len(s)]
if s == s[::-1]:
    if s1 == s1[::-1]:
        if s2 == s2[::-1]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
        
else:
    print('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] and T==T[::-1] and U==U[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

print('No')

Submission status: Accepted

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

S = input().strip()
n = len(S)


def check(S, n):
    if n % 2:
        for i in range((n - 1) // 2):
            if S[i] == S[n - 1 - i]:
                continue
            else:
                print('No')
                sys.exit()
    else:
        for i in range(n // 2):
            if S[i] == S[n - 1 - i]:
                continue
            else:
                print('No')
                sys.exit()


check(S, n)
check(S[:(n - 1) // 2], (n - 1) // 2)
check(S[(n + 3) // 2 - 1:], len(S[(n + 3) // 2 - 1:]))

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

def kaibun(s):
    n = len(s)
    ret = 1
    for i in range(n // 2):
        if s[i] != s[n - i - 1]:
            ret *= 0

    return(ret)

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

    ans = kaibun(s)
    ans *= kaibun(s[:(n - 1) // 2])
    ans *= kaibun(s[(n + 1) // 2:])

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

n1 = int((l - 1) / 2) 
n2 = int((l + 3) / 2) - 1

s1 = n[0:n1]
s2 = n[n2:]

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

Submission status: Accepted

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

Submission status: Accepted

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

s = list(input())
fl = True

sf = list(s)
sf.reverse()

if sf != s:
    fl = False
else:
    s1 = s[:len(s)//2]
    s1r = list(s1)
    s1r.reverse()
    if s1 != s1r:
        fl = False
    else:
        s2 = s[(len(s) + 3) // 2 - 1:]
        s2r = list(s2)
        s2r.reverse()
        if s2r != s2:
            fl = False

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

Submission status: Accepted

Solution code:
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():

    S=str(input())
    l=len(S)
    """
    print(S[(l + 3) // 2-1:])
    print(S[l-1:(l + 3) // 2-2:-1])
    """

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


resolve()

Submission status: Accepted

Solution code:
S = input()
length = len(S)
S_rev = ''.join(reversed(S))
S_portion = S[0:(length-1)//2]
S_portion_rev = ''.join(reversed(S_portion))

if S == S_rev and S_portion == S_portion_rev:
	print("Yes")
else:
	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range((n-1)//2):
  if A[i] != A[n-1-i]:
    print('No')
    break
else:
  for i in range((n-1)//2):
    if A[i] != A[(n-3)//2 - i]:
      print('No')
      break
  else:
    print('Yes')

Submission status: Accepted

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

  return True


def test(s):
  if not a(s):
    return "No"

  n = len(s)
  if not a(s[:(n - 1) // 2]):
    return "No"

  if not a(s[(n + 3) // 2 - 1:]):
    return "No"

  return "Yes"


print(test(input().strip()))

Submission status: Accepted

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

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

#回文かどうかチェック
isKaibun = True
for i in range((n-1)//2):
    if s[i] != s[-(i+1)]:
        isKaibun = False
if isKaibun:
    pass
else:
    print("No")
    exit()

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

#回文かどうかチェック
isKaibun = True
for i in range((n-1)//2):
    if s[i] != s[-(i+1)]:
        isKaibun = False
if isKaibun:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

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

S = ns()
N = len(S)
#print(S)
#print(S[0:(N-1)//2])
#print(S[(N+3)//2-1:N])
if kaibun(S) != True:
    print('No')
elif kaibun(S[0:(N-1)//2]) != True:
    print('No')
elif kaibun(S[(N+3)//2-1:N]) != True:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

a = s[:(n-1)//2]
b = s[((n+3)//2)-1:]
s_r = "".join(list(reversed(s)))
a_r = "".join(list(reversed(a)))
b_r = "".join(list(reversed(b)))

if s==s_r and a==a_r and b==b_r:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

def kaibun(string):
    if len(string) > 1:
        if string[0] == string[-1]:
            return kaibun(string[1:-1])
        else:
            return 0
    else:
        return 1

if kaibun(S)==1:
    if kaibun(S2) == 1:
        if kaibun(S3) == 1:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

def flip(S):

    flipedS = ""
    for i in range(len(S)-1, -1, -1):
        flipedS += S[i]

    return flipedS  

def main(S):

    N = len(S)
    flipedS = flip(S)
    
    frontS = S[:((N-1)//2)]
    rearS  = S[((N+3)//2)-1:]
    fliped_frontS = flip(frontS)
    fliped_rearS  = flip(rearS)
    

    if S == flipedS and frontS == fliped_frontS and rearS == fliped_rearS:
        return "Yes"
    else:
        return "No"

if __name__ == "__main__":

    answer = main(S)
    print(answer)

Submission status: Accepted

Solution code:

def is_strong_kaibun(s):
    # kaibun
    if not is_kaibun(s):
        return False

    n = len(s)
    subs = s[:(n-1)//2]
    if not is_kaibun(subs):
        return False

    subs = s[((n+3)//2)-1:]
    if not is_kaibun(subs):
        return False

    return True

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


s = input()

if is_strong_kaibun(s):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ans = 'Yes'

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

for j in range(len(a)//2):
    if a[j] == a[-1*(j+1)]:
        continue
    else:
        ans = 'No'
        break
        
for k in range(len(b)//2):
    if b[k] == b[-1*(k+1)]:
        continue
    else:
        ans = 'No'
        break
        
print(ans)

Submission status: Accepted

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


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


if not is_kaibun(s):
    print('No')
elif not is_kaibun(s[:n//2]):
    print('No')
elif not is_kaibun(s[(n+2)//2:]):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

s = input()
n = len(s)
a = []
for i in range(int((n-1)/2)):
    a.append(s[i])
b = []
for i in range(int(((n+3)/2)-1), len(s)):
    b.append(s[i])
if a == b:
    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]

if s1!=s2:
    print("No")
    exit()

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

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

print("Yes")

Submission status: Accepted

Solution code:
s = input()
r = 'Yes'
s2 = s[0:((len(s)-1)//2)]
s3 = s[((len(s)+3)//2)-1:len(s)]
if s != s[::-1] or s2 != s2[::-1] or s3 != s3[::-1]:
	r = 'No'
print(r)

Submission status: Accepted

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


s = str(input())
n = len(s)
if kaibun(s):
    if kaibun(s[0:round((n - 1) / 2)]):
        if kaibun(s[round((n + 3) / 2) - 1:]):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

def kaibun(s):
    n = len(s)
    flag = True
    for i in range(n // 2):
        if s[i] == s[n-i-1]:
            continue
        else:
            flag = False
            break
    return flag


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())
l = len(s)
s1 = s[0:int((l+1)/2)-1]
#s2 = s[(l+1)/2-1]
s3 = s[int((l+1)/2):]
if s1 == s3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def is_kaibun(s):
    r = list(s)
    r.reverse()
    str_r = "".join(r)
    if s == str_r:
        return True
    else:
        False

str_s = input()
n = len(str_s)
part_str_a = str_s[0:(n-1)//2]
part_str_b = str_s[(n+3)//2-1:n]
result = True


if not is_kaibun(str_s):
    result = False
if not is_kaibun(part_str_a):
    result = False
if not is_kaibun(part_str_b):
    result = False

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

Submission status: Accepted

Solution code:
S = input()

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

S0 = S[0:(len(S)-1)//2]
S1 = S[(len(S)+3)//2-1:len(S)]

if judge(S) and judge(S0) and judge(S1):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
S = list(input())
cnt = 0
cnt2 = 0
for i in range(len(S)//2):
    if S[i]==S[len(S)-i-1]:
        cnt+=1
if cnt==len(S)//2:
    for j in range(len(S)//4):
        if S[j]==S[len(S)//2-j-1] and S[len(S)-1-j]==S[len(S)//2+j+1]:
            cnt2+=1
if cnt2==len(S)//4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

sta = input()
N = len(sta)
sta_a = sta[0:(N-1)//2]
sta_b = sta[(N-1)//2+1:]


if ispalindrome(sta) and ispalindrome(sta_a) and ispalindrome(sta_b):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

l_1 = letter[:int((N-1)/2)]
l_2 = letter[int((N+3)/2-1):]

if(letter == letter[::-1] and l_1 == l_1[::-1] and l_2 == l_2[::-1]):
    ans = "Yes"
else:
    ans = "No"
# print(l_1)
# print(l_2)

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = input().strip()

def cond():
    p1 = ((len(s) - 1)//2)
    p2 = (len(s) + 3)//2 - 1
    t1 = s[:p1]
    t2 = s[p2:]
    return s == ''.join(reversed(s)) and t1 == ''.join(reversed(t1)) and t2 == ''.join(reversed(t2))

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
if not S == S[::-1]:
    print('No')
    exit()

S2 = S[:(N-1)//2]
if not S2 == S2[::-1]:
    print('No')
    exit()

S3 = S[(N + 3) // 2 - 1: ]
if not S3 == S3[::-1]:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

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

end = (N-1)//2
stt = (N+3)//2

S1 = S[:end]
S2 = S[stt-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()
if S != S[::-1]:
  print('No')
else:
  subS = S[:len(S) // 2]
  if subS == subS[::-1]:
    print('Yes')
  else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
S = [i for i in S]

if ( S == list(reversed(S))):
    S1 = S[:int((len(S)-1)/2)]
    if (S1 == list(reversed(S1))):
        S2 = S[int((len(S)+3)/2)-1:]
        if(S2 == list(reversed(S2))):
            print("Yes")
        else:        
            print("No")        
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
def is_kai(s, r):
  return(s == r)

S = input()
N = len(S)

mae = []
flag = is_kai(S, S[::-1])

be_idx = int((N-1)/2)
af_idx = int((N+3)/2-1)

be = S[:be_idx]
af = S[af_idx:]

if is_kai(S,S[::-1]) and is_kai(be, be[::-1]) and is_kai(af, af[::-1]):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

#print(S[:int((n-1)/2)], S[:int((n-1)/2)][::-1])
#print(S[:int((n-1)/2)] , S[:int((n-1)/2)][::-1])
#print(S[int((n+1)/2):], S[int((n+1)/2):][::-1])                  
if S[:int((n-1)/2)] == S[:int((n-1)/2)][::-1] and S[int((n+1)/2):]== S[int((n+1)/2):][::-1] and S[:int((n-1)/2)] == S[int((n+1)/2):][::-1]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
S = input().strip()

tmp = list(S)
tmp.reverse()
reversedS = "".join(tmp)

if S != reversedS:
    print("No")
    sys.exit(0)

T = S[:(len(S)-1)//2]

tmp = list(T)
tmp.reverse()
if T != "".join(tmp):
    print("No")
    sys.exit(0)

W = S[(len(S)+3)//2-1:]

tmp = list(W)
tmp.reverse()
if W != "".join(tmp):
    print("No")
    sys.exit(0)

print("Yes")

Submission status: Accepted

Solution code:
n = input()
if n == n[::-1]:
    zenhan = n[0:int(len(n)//2)]
    if zenhan == zenhan[::-1]:
        kouhan = n[int(len(n)//2)+1::]

        if kouhan == kouhan[::-1]:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

Solution code:
def main():
  s = input()
  length = len(s)

  nagasa = int((length - 1) / 2)
  former = list(s)[:nagasa]
  later = list(s)[-nagasa:]

  if former == later[::-1] and former == former[::-1] and later == later[::-1]:
    print('Yes')
  else:
    print('No')
main()

Submission status: Accepted

Solution code:
#!/usr/bin/python3
String = str(input())
Mid = len(String) // 2 
StrFormer = String[0:Mid]
StrFormer_inv = StrFormer[::-1]
StrLater = String[:Mid:-1]
StrLater_inv = StrLater[::-1]
if StrFormer == StrFormer_inv and StrLater == StrLater_inv:
    if StrFormer == StrLater:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
# 2020/03/22
# AtCoder Beginner Contest 159 - B

# Input
s = input()
l = len(s)
cidx = (l // 2) + 1

kflg = True

for i in range(l):
    if s[i] != s[l-1-i]:
        kflg = False
        break

if kflg == True:
    for x in range(cidx - 2):
        if s[x] != s[cidx-2-x]:
            kflg = False
            break

if kflg == True:
    for y in range(cidx, l):
        if s[y] != s[l-1-(y-cidx)]:
            kflg = False
            break

# Calc
if kflg == True:
    ans = "Yes"
else:
    ans = "No"

# Output
print(ans)

Submission status: Accepted

Solution code:
def kaibun(s):
    N=len(s)
    f=1
    if N%2 == 0:
        for i in range(int(N/2)):
            if s[i] != s[N -i -1]:
                f=0
    else:
        for i in range(int((N+1)/2)):
            if s[i]!=s[N-1-i]:
                f=0
    return f


s=input()
N=len(s)
c = 1
'''
for i in range(int((N-1)/2)):
    if s[i]!=s[N-1-i]:
        c=0
d = 1
f = (N-1)/2 % 2

if f == 0:
    for i in range(int((N-1)/4)):
        if s[i]!=s[int((N-1)/2)-1-i]:
            d=0
else:
     for i in range(int(((N-1)/2 -1)/2)):
        if s[i]!=s[int(((N-1)/2 -1)/2-i)]:
            d=0

if c*d == 0:
    print("No")
else:
    print("Yes")
'''

if kaibun(s)*kaibun(s[0:int((N-1)/2)]) == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S = input().rstrip("\r\n")
N = len(S)
ans = "Yes"
for i in range(N):
    if S[i] != S[N-1-i]:
        ans = "No"
        break
for i in range((N-1)//2):
    if S[i] != S[(N-1)//2-1-i]:
        ans = "No"
        break
for i in range((N+3)//2-1, N):
    if S[i] != S[N-1-i]:
        ans = "No"
        break
print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input()
    length = len(S)
    S1 = S[0:int((length-1)/2)]
    S2 = S[int((length+3)/2-1):length]
    ans = "Yes"
    for i in range(len(S)):
        if S[i] != S[-i-1]:
            ans = "No"
            break
    for i in range(len(S1)):
        if S1[i] != S1[-i-1]:
            ans = "No"
            break
    for i in range(len(S2)):
        if S2[i] != S2[-i-1]:
            ans = "No"
            break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()


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


if is_kaibun(s) is True and is_kaibun(s[:len(s) // 2]) is True and is_kaibun(s[len(s) // 2 +1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = list(input())
N = len(S)

sub1 = S[:(N-1)//2]
sub2 = S[(N+2)//2:]

Sc = S.copy()
sub1c = sub1.copy()
sub2c = sub2.copy()

Sc.reverse()
sub1c.reverse()
sub2c.reverse()

#print("S:{}, Sc:{}".format(S, Sc))
#print("sub1:{}, sub1c:{}".format(sub1,sub1c))
#print("sub2:{}, sub2c:{}".format(sub2,sub2c))

if S==Sc and sub1==sub1c and sub2==sub2c:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

s01 = s[:u]
s02 = s[-u:]

s1 = s01[:u]
s2 = s01[-u:]
s3 = s02[:u]
s4 = s02[-u:]

ms = 'Yes'
for t1,t2,t3,t4 in zip(s1,s2,s3,s4):
  if not (t1==t2 and t2 == t3 and t3== t4):
    ms = 'No'
    break
    
print(ms)

Submission status: Accepted

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

def is_kaibun(s):
    left = 0
    right = len(s)-1
    while left <= right:
        if s[left] != s[right]:
            return False
        left += 1
        right -= 1
    return True

def solve():
    S = input()
    N = len(S)

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def isKaibun(str):
    isKaibun = True
    length = len(str)
    for i in range(length):
        if str[i] != str[length - i - 1]:
            isKaibun = False
            break
    return isKaibun

# 整数の入力
S = input()

N = len(S)

output = "No"

flag1 = isKaibun(S)
flag2 = isKaibun(S[0 : int(((N-1)/2))])
flag3 = isKaibun(S[int(((N+3)/2)-1): N])

if flag1 and flag2 and flag3:
    output = "Yes"

###########　出力
print(output)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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


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


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

Submission status: Accepted

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

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

a1=int((n-1)/2)
a2=int((n+3)/2-1)

s1=s[0:a1]
s2=s[a2:n]

if Palindrome(s1) and Palindrome(s2) and Palindrome(s) == True:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
S_1 = S[0:int((N - 1)/2)]
S_2 = S[int((N + 3)/2) - 1:N + 1]

ans = "No"
if S == S[::-1] and S_1 == S_1[::-1] and S_2 == S_2[::-1]:
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
inp = input()

N = len(inp)

s1 = inp[0:(N-1)//2]
s2 = inp[(N+1)//2:N]

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

Submission status: Accepted

Solution code:
import math

S = input()
N = len(S) # N is odd from 3 to 99

subS1 = S[:int((N-1)/2)]
subS2 = S[int((N+3)/2-1):]

def is_kaibun(string):
  kaibun = True
  if len(string)%2==0:
    # if even,
    for i in range(int(len(string)/2)):
      kaibun = kaibun and string[i]==string[-(i+1)]
  else:
    # if odd,
    for i in range(int((len(string)-1)/2)):
      kaibun = kaibun and string[i]==string[-(i+1)]
  return kaibun

answer = is_kaibun(S) and is_kaibun(subS1) and is_kaibun(subS2)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = raw_input()
l =[]
l.append( s == s[::-1])
tn = (len(s)-1)/2
l.append(s[:tn] == s[:tn][::-1])
nn = (len(s)+3)/2
l.append(s[nn-1:] == s[nn-1:][::-1])
print "No" if False in l else "Yes"

Submission status: Accepted

Solution code:
# coding: utf-8
 
s = input()
n = len(s)
f = 1

ss = s[:(n-1)//2]
for i in range((n-1)//4):
    if not ss[i] == ss[-1*(i+1)]:
        f = 0
        break

tt = s[(n+3)//2-1:]
for i in range((n-1)//4):
    if not tt[i] == tt[-1*(i+1)]:
        f = 0
        break

if ss != tt:
    f = 0

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

Submission status: Accepted

Solution code:
s=input()
ls =len(s)
for i in range(ls//2):
    if s[i]!=s[ls-1-i]:
        print("No")
        exit(0)
s1=s[0:(ls-1)//2]
ls1=len(s1)
for i in range(ls1//2):
    if s1[i]!=s1[ls1-1-i]:
        print("No")
        exit(0)
s2=s[(ls+1)//2:]
ls2=len(s2)
for i in range(ls2//2):
    if s2[i]!=s2[ls2-1-i]:
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def IsPalindrome(S):
	l = len(S)
	for i in range(l >> 1):
		if S[i] != S[-(i + 1)]:
			return False
	return True

S = input()

m = len(S) >> 1
L, R = [""] * (m), [""] * (m)
for i in range(m):
	L[i] = S[i]
	R[i] = S[i + m + 1]

if not (IsPalindrome(L) and IsPalindrome(S) and IsPalindrome(R)):
	print("No")
else:
	print("Yes")

Submission status: Accepted

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

def main():
    s = input().rstrip()

    n = len(s)

    if s == s[::-1]:
        if s[:int((n-1)/2)] == s[:int((n-1)/2)][::-1]:
            if s[int((n+1)/2):] == s[int((n+1)/2):][::-1]:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

s0 = S[:len(S)//2]
s1 = S[len(S)//2+1:]

def f(s):
    n = len(s)
    halfn = n//2
    result = True
    for i in range(halfn):
        if s[i] != s[-(i+1)]:
            result = False

    return result

ans = 'Yes'
if not f(S):
    ans = 'No'
elif not f(s0):
    ans = 'No'
elif not f(s1):
    ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def isParindrom(l):
    invers = l[::-1]
    if l == invers:
        return True
    return False

def solve(S: str):
    N = len(S)
    if N % 2 == 0:
        print(NO)
        return

    if not isParindrom(S):
        print(NO)
        return 
    
    num = (N - 1) // 2
    p = S[:num]

    if not isParindrom(p):
        print(NO)
        return
    
    num = (N + 3) // 2 - 1
    r = S[num:]

    if not isParindrom(r):
        print(NO)
        return
    
    print(YES)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()