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)
flag = True

if S!=S[::-1]:
    flag=False
if S[:int((N-1)/2)]!=S[:int((N-1)/2)][::-1]:
    flag=False
print("Yes" if flag else "No")

Submission status: Accepted

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

if S!="".join(reversed(list(S))):
    flag=False
if S[:int((N-1)/2)]!="".join(reversed(list(S[:int((N-1)/2)]))):
    flag=False
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
flag = [0,0,0]


if S=="".join(reversed(list(S))):
    flag[0]=1
if S[:int((N-1)/2)]=="".join(reversed(list(S[:int((N-1)/2)]))):
    flag[1]=1
if S[int((N+3)/2)-1:]=="".join(reversed(list(S[int((N+3)/2)-1:]))):
    flag[2]=1
print("Yes" if flag==[1,1,1] else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def is_palindrome(s):
    if len(s) % 2:
        a, b = s[:len(s) // 2], s[len(s) // 2 + 1:]
    else:
        a, b = s[:len(s) // 2], s[len(s) // 2:]
    return a == ''.join(reversed(b))


def resolve(in_):
    s = in_.readline().strip()
    ret = is_palindrome(s) and is_palindrome(s[:len(s) // 2]) and is_palindrome(s[len(s) // 2 + 1:])
    return 'Yes' if ret else 'No'


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
n = len(s)
flag = 1
for i in range(int(n/2)):
    if s[i] != s[n-i-1]:
        flag = 0
        break
n2 = int((n-1)/2)
if flag == 1:
    for i in range(int(n2/2)):
        if s[i] != s[n2-i-1]:
            flag = 0
            break
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
N=len(S)
M=(N-1)//2
def iskaibun(T):
    K=len(T)
    for i in range(K):
        if T[i]==T[-i-1]:
            pass
        else:
            return False
    return True

if iskaibun(S) and iskaibun(S[:M]) and iskaibun(S[M+1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def is_p(s):
    return s == s[::-1]
s = input()
n = len(s)
l = (n - 1)//2
r = l + 1
print('Yes' if is_p(s) and is_p(s[:l]) and is_p(s[r:]) else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
n_1=int((n-1)/2)
n_2=int((n+1)/2)

s_1=s[:n_1]
s_2=s[n_2:]

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

Submission status: Accepted

Solution code:
def isPalindrome(st):
    l = len(st)
    c = l//2
    if l%2 == 1:
        return st[:c] == st[c+1:][::-1]
    else:
        return st[:c] == st[c:][::-1]

S = input()
N = len(S)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

S1 = S[:int(N/2)]
S2 = S[int(N/2)+1:N]
#print(S1)
#print(S2)

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

    if(S1[i] != S1[int(N/2)-1-i]):
        print("No")
        exit()

    if(S2[i] != S2[int(N/2)-1-i]):
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    if S != S[::-1]:
        return False

    t = S[:(N - 1) // 2]
    if t != t[::-1]:
        return False

    t = S[(N + 3) // 2 - 1:]
    if t != t[::-1]:
        return False

    return True


def main():
    if solve():
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')
YES = "Yes"  # type: str
NO = "No"  # type: str


def is_palindrome(s: str):
    return s[:len(s)//2] == s[::-1][:len(s)//2]


def solve(S: str):
    return [NO, YES][is_palindrome(S) and is_palindrome(S[:(len(S)-1)//2-1+1]) and is_palindrome(S[(len(S)+3)//2-1:])]


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print(f'{solve(S)}')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
lenS = len(S)
ans = "No"

def checkPalindrome(string):
    l = len(string)
    string2 = string[::-1]
    if string[:l//2] == string2[:l//2]:
        return True
    else:
        return False

if checkPalindrome(S):
    if checkPalindrome(S[:(lenS-1)//2]):
        if checkPalindrome(S[(lenS+3)//2-1:]):
            ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
# abc159_b.py
# https://atcoder.jp/contests/abc159/tasks/abc159_b

# B - String Palindrome /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 長さが奇数である文字列 Sが以下の条件をすべて満たすとき、Sは「強い回文」であるといいます。
#     Sは回文である。
#     Nを S の長さとするとき、S の 1 文字目から (N−1)/2文字目まで(両端含む)からなる文字列は回文である。
#     Sの (N+3)/2 文字目から N文字目まで(両端含む)からなる文字列は回文である。
# Sが強い回文かどうかを判定してください。

# 制約
#     Sは英小文字のみからなる
#     Sの長さは 3 以上 99以下の奇数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# S

# 出力
# S

# が強い回文ならば Yes 、 強い回文でないならば No と出力せよ。

# 入力例 1
# akasaka

# 出力例 1
# Yes

# Sは akasaka
# Sの 1 文字目から 3文字目までからなる文字列は aka
# Sの 5 文字目から 7文字目までからなる文字列は aka
# これらはすべて回文であるため、Sは強い回文です。

# 入力例 2
# level

# 出力例 2
# No

# 入力例 3
# atcoder

# 出力例 3
# No


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[0]
    # N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    n = int((len(S)-1)/2)

    if is_kaibun(S) is not True:
        return ['No']
    if is_kaibun(S[:n]) is not True:
        return ['No']
    if is_kaibun(S[-n:]) is not True:
        return ['No']

    return ['Yes']


def is_kaibun(s):
    t = ''.join(list(reversed(s)))
    if s == t:
        return True
    else:
        return False


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['akasaka']
        lines_export = ['Yes']
    if pattern == 2:
        lines_input = ['level']
        lines_export = ['No']
    if pattern == 3:
        lines_input = ['atcoder']
        lines_export = ['No']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))


s = input()

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

if s == s[::-1]:
    if s1 == s1[::-1]:
        if s2 == s2[::-1]:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:
import numpy as np


def check_pali(S):
    for i in range(0, len(S)):
        if S[i] != S[-1 * i + -1]:
            return False

        elif i > (len(S) / 2) + 1:
            break

    return True


S = input()

N = len(S)

short_N = (N - 1) // 2
long_N = (N + 3) // 2


if check_pali(S) & check_pali(S[0:short_N]) & check_pali(S[long_N-1:N]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

s = list(S)
f = s[:int((len(s)-1)/2)]
l = s[int((len(s)+3)/2-1):]

if f == l:
    while len(f) > 1:
        if f[0] == f[-1]:
            f.pop(0)
            f.pop()
    if len(f) <= 1:
        while len(l) > 1:
            if l[0] == l[-1]:
                l.pop(0)
                l.pop()
        if len(l) <= 1:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
si=s[::-1]
a=s[:(len(s)-1)//2]
b=s[(len(s)+1)//2:]
if s == si :
    if a == a[::-1] and b == b[::-1]:
        print(("Yes"))
        exit()
print("No")

Submission status: Accepted

Solution code:
S = input()
answer = 'Yes'
if S != S[::-1]:
    answer = 'No'
first = S[:len(S) // 2]
last = S[len(S) // 2 + 1:]
if first != first[::-1]:
    answer = 'No'
if last != last[::-1]:
    answer = 'No'
print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=str(input())
ans=0
if s==s[::-1] and s[:(len(s)-1)//2]==s[(len(s)-1)//2-1::-1] and s[(len(s)+3)//2-1:]==s[:(len(s)+3)//2-2:-1]:
    ans+=1
print("NYoe s"[ans::2])

Submission status: Accepted

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

S = input()

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

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

end = S[(len(S)+1)//2:]
for i in range(len(end)//2):
  if end[i] != front[len(end)-1-i]:
    ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
import sys
S = input()

if not S.islower():sys.exit()
if not ( 3 <= len(S) <= 99 and len(S) % 2 == 1 ): sys.exit()

# whole check
first = int((len(S)-1)/2)
F = S[0:first]
last = int((len(S)+3)/2)
L = S[last-1:]
condition = 0
if S == S[::-1]:
    condition += 1
if F == F[::-1]:
    condition += 1
if L == L[::-1]:
    condition += 1

print('Yes') if condition == 3 else print('No')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if s == s[::-1] and 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')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().decode().rstrip()
N = len(S)
half = N // 2
for i in range(half):
    if S[i] != S[-(i+1)]:
        print('No')
        sys.exit()
SS = S[:half]
for i in range(half//2):
    if SS[i] != SS[-(i+1)]:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

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

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

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r


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


for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
S = input()
N = len(S)
count1,count2,count3 = 0,0,0
flg1,flg2,flg3 = False,False,False
for i in range(N):
    #print(S[i],S[-1-i])
    if S[i] == S[-1-i]:
        count1 += 1
if count1 == N:
    flg1 = True
#print(count1,flg1)
a = int((N-1)/2)
for i in range(a):
    #print(S[i],S[a-1-i])
    if S[i] == S[a-1-i]:
        count2 += 1
if count2 == int((N-1)/2):
    flg2 = True
#print(count2,flg2,a)
b = int((N+3)/2)
#print(b)
for i in range(N-b+1):
    #print(S[b+i-1],S[N-1-i])
    if S[b+i-1] == S[N-i-1]:
        count3 += 1
if count3 == N-b+1 :
    flg3 = True
if flg1 == True and flg2 == True and flg3 == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# B String Palindrome

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

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

S = input()
N = len(S)

SS = S[0:(N-1)//2]
NN = len(SS)

SSS = S[((N+3)//2)-1:]
NNN = len(SSS)

check(S, N)
if len(SS)%2 == 0:
  ot_check(SS, NN)
else:
  check(SS, NN)
if len(SSS)%2 == 0:
  ot_check(SSS, NNN)
else:
  check(SSS, NNN)

print("Yes")

Submission status: Accepted

Solution code:
# ABC 159 B
s = input()
n = len(s)
l = s[:((n-1)//2)]
r = s[((n+3)//2) -1:]
if s == s[::-1] and l == l[::-1] and r == r[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

def kaibun(s):
    if s == s[::-1]:
        return 1
    else:
        return 0
        
q = len(s)
d = int((q-1)/2)
ket = s[0:d]
mat = s[int((q+1)/2):q]

if (kaibun(s) + kaibun(ket) + kaibun(mat)) == 3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

mozisuu=len(s)

def hanteiki(s):
    hantei=True
    mozisuu=len(s)
    for i in range(len(s)):
        if s[i]!=s[mozisuu-i-1]:
            hantei=False
    return hantei
            
if hanteiki(s):
    if hanteiki(s[0:(mozisuu-1)//2]):
        if hanteiki(s[(mozisuu+3)//2-1:]):
            print("Yes")
            exit()

print("No")

Submission status: Accepted

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

check_1 = palindrome(s)
check_2 = palindrome(s[:(n)//2])
check_3 = palindrome(s[(n+2)//2:])

if check_1 and check_2 and check_3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
n = len(S)
confS = S[::-1]
flag1 = False
flag2 = False
flag3 = False
s1 = S[0:int((n-1)/2)]
confs1 = s1[::--1]
s2 = S[int((n+3)/2)-1:n]
confs2 = s2[::-1]
if S == confS:
  flag1 = True
if s1 == confs1:
  flag2 = True
if s2 == confs2:
  flag3 = True
if flag1 and flag2 and flag3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S=input()
t=len(S)
print("YNeos"[sum(1for i in range(t) if S[i]!=S[~i] )!=0 or S[(t+2)//2:]!=S[:(t-1)//2]::2])

Submission status: Accepted

Solution code:
s=input();print(['No','Yes'][s[:len(s)//2]==s[len(s)//2+1:]])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
T=S[:(len(S)-1)//2]
U=S[(len(S)+3)//2-1:]
if S==S[::-1]:
    if T==T[::-1]:
        if U==U[::-1]:
            print('Yes')
        else:print('No')
    else:print('No')
else:print('No')

Submission status: Accepted

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

s_first = s[:(N-1)//2]
s_second = s[(N+1)//2:]

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

Submission status: Accepted

Solution code:
def flg(s):
  le = len(s) // 2
  return s[:le] == s[::-1][:le]


s = input()
le1 = len(s) // 2
t = s[:le1]

print(["No", "Yes"][flg(s) and flg(t)])

Submission status: Accepted

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


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


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


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


def main():
    S = input()
    N  = len(S)
    
    for i in range(N):
        if S[i] != S[N-i-1]:
            print("No")
            exit()
    half = int((N-1)/2)
    for i in range(half):
        if S[i] != S[half-i-1]:
            print("No")
            exit()
            
    for i in range(half+2,N):
        if S[i] != S[N-i-1]:
            print("No")
            exit()
        
    print("Yes")
    


main()

Submission status: Accepted

Solution code:
s = input()

flag = 1

l = len(s)

for i in range((l-1)//2):
    if s[i] == s[(l-1)//2 - 1-i]:
        continue
    else:
        flag = 0
        break

if s[:(l-1)//2] != s[(l+3)//2-1:]:
    flag = 0

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

Submission status: Accepted

Solution code:
s = str(input())
s_len = int((len(s) - 1) / 2)

s_1 = s[:s_len]
s_1_len = int((len(s_1) - 1) / 2)

s_2 = s[s_len+1:]
s_2_len = int((len(s_2) - 1) / 2)

ans = 'Yes'

for i in range(s_len+1):
  if s[i] != s[-i-1]:
    ans = 'No'
    break

for i in range(s_1_len+1):
  if s_1[i] != s_1[-i-1]:
    ans = 'No'
    break

for i in range(s_2_len+1):
  if s_2[i] != s_2[-i-1]:
    ans = 'No'
    break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
L = len(S)
for i in range((L-1)//2):
    if S[i] != S[L-1-i]:
        print("No")
        exit()

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

for i in range(L-1, L - (L-1)//4, -1):
    if S[i] != S[i - (L-1)//2-1]:
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
s = input()
ans = 'Yes'
for i in range(len(s)//2):
    if s[i] != s[-i-1]:
        ans = 'No'
        break
        
s_s = s[:(len(s)-1)//2]
for i in range(len(s_s)//2):
    if s_s[i] != s_s[-i-1]:
        ans = 'No'
        break
        
s_e = s[(len(s)+3)//2 - 1:]
for i in range(len(s_e)//2):
    if s_e[i] != s_e[-i-1]:
        ans = 'No'
        break
        
print(ans)

Submission status: Accepted

Solution code:
S=input()
i=0
kot=[]
for a in S:
    kot.append(a)
tok=list(reversed(kot))

for a in range(len(kot)):
    if kot[a]==tok[a]:
        i=0
    else:
        print("No")
        i=1
        break
if i==0:
    for a in range(int((len(kot)-1)/2)):
        if kot[a]==tok[int((len(kot)-1)/2)-a-1]:
            i=0
        else:
            print("No")
            i=1
            break

if i==0:
        for a in range(int((len(kot)-1)/2)):
            if kot[int((len(kot)+3)/2)+a-1]==tok[-a-1]:
                i=0

            else:
                print("No")
                i=1
                break

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
s_re =s[::-1]
s_first = s[:(n-1)//2]
s_first_re = s_first[::-1]
s_second = s[(n+3)//2-1:]
s_second_re = s_second[::-1]

print(['No','Yes'][s == s_re and s_first==s_first_re and s_second == s_second_re])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for k in range(0, (N-1)//2):
  if S[k] == S[(N-1)//2 - k -1] == S[(N-1)//2 + k + 1] == S[-k-1]:
    continue
  else:
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
p=n//2
t=1

for i in range(p):
    if s[i]==s[p-1-i]:
        t=1
    else:
        t=0
        break;

x=1

for i in range(p):
    if s[p+1+i]==s[n-1-i]:
        x=1
    else:
       x=0
       break

y=1

for i in range(n):
    if s[i]==s[n-1-i]:
        y=1
    else:
       y=0
       break

if (t==1 and x==1 and y==1):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

r_S = S[::-1]

head_S = S[0: int((N - 1) / 2)]
r_head_S = head_S[::-1]

end_S = S[int((N+3)/2 - 1) : N+1]
r_end_S = end_S[::-1]

if S == r_S and head_S == r_head_S and end_S == r_end_S:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def isPalindrome(string):
    flag = True
    len_string = len(string)
    if len_string == 1:
        return flag
    for i in range(len_string//2):
        if string[i] != string[-1-i]:
            flag = False
            break
    return flag

S = input()
len_s = len(S)
fro_s = S[:len_s//2]
if len_s % 2 == 0:
    bak_s = S[-len_s//2:]
else:
    bak_s = S[-len_s//2 + 1:]

if isPalindrome(S) and isPalindrome(fro_s) and isPalindrome(bak_s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
s=len(S)
a=''
b=''
for i in range((s-1)//2):
    a+=S[i]
for n in range((s+3)//2-1,s):
    b+=S[n]
if a==b:
    A=a[::-1]
    B=b[::-1]
    if A==a and B==b:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
S=input()
s=len(S)
a=''
b=''
for i in range(0,(s-1)//2):
    a+=S[i]
for n in range((s+3)//2-1,s):
    b+=S[n]
if a==b:
    A=a[::-1]
    B=b[::-1]
    if A==a and B==b:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

s = input()
n = len(s)

ans = False
if is_kaibun(s):
    s = s[:n//2]
    if is_kaibun(s):
        ans = True
        
if ans:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def is_palindrome(s):
    return s == s[::-1]


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    S = list(input().rstrip())
    N = len(S)
    if S != list(reversed(S)):
        print("No")
    elif S[:int((N-1)/2)] != list(reversed(S[:int((N-1)/2)])):
        print("No")
    elif S[int((N+3)/2) - 1:] != list(reversed(S[int((N+3)/2) - 1:])):
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()

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:
s=input()
n=len(s)
def f(s):
    m=len(s)
    for i in range(-(-m//2)):
        if s[i]!=s[-1-i]:
            return False
    return True

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

Submission status: Accepted

Solution code:
S = input()
m = len(list(S)) // 2
l = m + 1
print('Yes' if (S == S[::-1]) & (S[:m] == S[:m:][::-1]) & (S[l:] == S[l::][::-1]) else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

s = input()
len_s = len(s)
if is_kaibun(s[0:(len_s // 2)]) and is_kaibun(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def han(l):
    for i in range((len(l) // 2)):
        if l[i] != l[-i - 1]:
            return 0
    return 1

S = input()

f1 = han(S)
S2 = S[0:(len(S) // 2)]
S3 = S[len(S)//2 + 1 : len(S)]
f2 = han(S2)
f3 = han(S3)

if f1 * f2 * f3:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

if s == s[::-1]:
    if s2 == s2[::-1]:
        if s3 == s3[::-1]:
            print("Yes")
            sys.exit()

print("No")

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    N = len(S)

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
l = len(S)
T = ''.join(list(reversed(S)))

a = S[:(l-1)//2]
a1 = ''.join(list(reversed(a)))

b = S[(l+3)//2-1:l]
b1 = ''.join(list(reversed(b)))

if S == T:
    if a == a1 and b == b1:
        print('Yes')
    if a != a1 or b != b1:
        print('No')
if S != T:
    print('No')

Submission status: Accepted

Solution code:
S = input()

def iskai(s):
  result=False
  if s == s[::-1]:
    result=True
  return(result)

ans = 'No'
hf = len(S)//2 + 1

if iskai(S) and iskai(S[:hf-1]) and iskai(S[hf:]):
  ans = 'Yes'
  
print(ans)

Submission status: Accepted

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