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:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

S = str(input())
n = len(S)

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

for i in range((n-1)//2):
    if S[i] != S[(n-3)//2-i]:
        print('No')
        exit()

for i in range((n+1)//2,n):
    if S[i] != S[(3*n-1)//2-i]:
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()
div = len(s)//2
pre = s[:div]
post = s[div+1:]
print('Yes' if pre == post else 'No')

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=S()
  n=len(s)
  ls=list(s)

  f=True
  _s=copy.deepcopy(ls)
  _s.reverse()
  if _s!=ls:
    f=False

  ls2=ls[:(n-1)//2]
  _ls2=copy.deepcopy(ls2)
  _ls2.reverse()

  if ls2!=_ls2:
    f=False

  ls3=ls[(n+3)//2-1:]
  _ls3=copy.deepcopy(ls3)
  _ls3.reverse()

  if ls3!=_ls3:
    f=False

  # print(ls,_s)
  # print(ls2,_ls2)
  # print(ls3,_ls3)

  if f:
    return 'Yes'
  return 'No'

# main()
print(main())

Submission status: Accepted

Solution code:
s = input()
t = s[:(len(s) - 1) // 2]
reversed2 = lambda x: ''.join(reversed(x))
print('Yes' if (s == reversed2(s) and t == reversed2(t)) else 'No')

Submission status: Accepted

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


st=input()
n=len(st)
#print(st[0:(n-1)//2],st[(n+3)//2:n])
if checkpal(st) and checkpal(st[0:(n-1)//2]) and checkpal(st[(n+3)//2-1:n]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

s = ins()
n = len(s)
m = (n-1)//2
for i in range(m//2):
    if not (s[i]==s[m-1-i]==s[m+1+i]==s[2*m-i]):
        print('No')
        exit()
if m%2==1 and s[m//2]!=s[m+1+m//2]:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S=input()

# print(S)
S_rev=S[::-1]
# print(S_rev)

N=len(S)
S_mae=S[:int((N-1)/2)]
S_usiro=S[int((N+3)/2)-1:]
# print(S_mae)
# print(S_usiro)
S_mae_rev=S_mae[::-1]
S_usiro_rev=S_usiro[::-1]

if S!=S_rev:
    print("No")
    exit()
if S_mae!=S_mae_rev:
    print("No")
    exit()
if S_usiro!=S_usiro_rev:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
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)
ans="Yes"

for i in range((N-1)//2):
    if not S[i]==S[N-1-i]==S[(N-3)//2-i]==S[(N+1)//2+i]:
        ans = "No"
        break
        
print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
s_1 = s[::-1]
s2 = s[0:int((n-1)/2)]
s_2 = s2[::-1]
s3 =s[int((n+3)/2)-1:]
s_3 = s3[::1]
if s==s_1 and s2==s_2 and s3==s_3:
  print('Yes')
else:
  print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

def ispal(x):
    for i in range((len(x)//2)+1):
        if x[i] !=x[len(x)-i-1]:
            return False
    return True
def main():
    s = input()
    n = len(s)
    # print(s[:(n-1)//2],s[:(n-1)//2+1])
    # print(ispal(s) ,ispal(s[:(n-1)//2]),ispal(s[(n+3)//2-1:]))
    if ispal(s) and ispal(s[:(n-1)//2]) and ispal(s[(n+3)//2-1:]):
        print('Yes')
    else:
        print('No')





# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def kaibun(S):
    return all([S[i] == S[-i-1] for i in range(len(S)//2)])

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

Submission status: Accepted

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

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


def solve(S: str):
    for i in range(len(S)):
        if S[i] != S[len(S) - i-1]:
            print(NO)
            exit()

    for i in range(len(S)//2):
        if S[i] != S[len(S)//2 - i-1]:
            print(NO)
            exit()

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

Submission status: Accepted

Solution code:
s = input()

def isPalindrome(t):
    if t != t[::-1]:
        return False
    n = len(t)

    l = t[:(n-1)//2]
    r = t[(n+3)//2-1:]
    # print(l, r)
    if l != l[::-1] or r != r[::-1]:
        return False

    return True

if isPalindrome(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

S = input().strip()

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

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

Submission status: Accepted

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


def f(x):
    return x == x[::-1]


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()
n = len(s)
ss = s[:(n - 1) // 2]
sss = s[(n + 3) // 2 - 1:]
flag = True;
for i in range(len(s)//2):
    if s[i] != s[n - 1 - i]:
        flag = False
if not flag:
    print("No")
    exit()

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

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

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:
s = input()
n = len(s)
 
def ok(s):
    n = len(s)
    for i in range(n//2):
        if s[i] != s[n-1-i]:
            return False
    return True
 
if ok(s) and ok(s[:n//2]) and ok(s[n//2+1:]):
        print('Yes')
else:
    print('No')

Submission status: Accepted

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

if s!=s[::-1]:
    print("No")
    exit()

s2 = s[:(n-1)//2]
if s2!=s2[::-1]:
    print("No")
    exit()

s3 = s[(n+3)//2-1:]
if s3!=s3[::-1]:
    print("No")
    exit()

print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
cnt = 0
if s == s[::-1]:
    cnt += 1
idx = (n-1)//2
if s[:idx] == s[:idx][::-1]:
    cnt += 1
idx = (n+3)//2-1
if s[idx:] == s[idx:][::-1]:
    cnt += 1
print("Yes" if cnt == 3 else "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] else 'No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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

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

N3 = (N+3)//2
for i in range(N-N3+1):
    if S[N3-1+i]!=S[N-1-i]:
        flag = False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
f = True
if s != s[::-1]:
    f = False

s1 = s[:(n-1)//2]
if s1 != s1[::-1]:
    f = False


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

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

Submission status: Accepted

Solution code:
n = input()
l = len(n)
n_r = n[::-1]
n_1 = n[:(l-1)//2]
n_2 = n[(l+3)//2 - 1:]

if n == n_r and n_1 == n_1[::-1] and n_2 == n_2[::-1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

#print(S)
#print(S[:int((N-1)/2+1)])
a = S[:int((N-1)/2)]
b = S[:int((N-1)/2):-1]
c = S[int((N+1)/2):]
d = S[int((N+1)/2):]
dd = d[::-1]
# print(a)
# print(b)
# print(c)
# print(dd)
if S == S[::-1] and a == b and c == dd:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#abc159 b

import itertools
from math import factorial
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7

#ここから書き始める
s = input()
c1 = False
c2 = False
c3 = False
n = len(s)

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

if s == s[::-1]:
    c1 = True

if s2 == s2[::-1]:
    c2 = True

if s3 == s3[::-1]:
    c3 = True

if c1 and c2 and c3:
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
c = 0
for i in range(n // 2):
    if s[i] != s[n - i - 1]:
        c = 1
        break
s0 = []
s1 = []
for i in range(n):
    if i < n // 2:
        s0.append(s[i])
    elif n // 2 < i:
        s1.append(s[i])
for i in range(len(s0) // 2):
    if s[i] != s[len(s0) - i - 1]:
        c = 1
        break
for i in range(len(s1) // 2):
    if s[i] != s[len(s1) - i - 1]:
        c = 1
        break
if c == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ans = "Yes"

if not S == S[::-1]:
  ans = "No"

T = S[0:(N-1)//2]
if not T == T[::-1]:
  ans = "No"

U = S[(N+3)//2-1:N]
if not U == U[::-1]:
  ans = "No"

print(ans)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
c = N//2

a = S[:c]
b = S[c+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()
n = len(s)
first_half = s[:(n - 1) // 2]
last_half = s[(n + 3) // 2 - 1:]

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

Submission status: Accepted

Solution code:
import math
s = input()

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

buf1 = s[0:(len(s)-1)//2]
buf2 = s[(len(s) + 3)//2 - 1:len(s)]

if ispalindrome(s) == 1 and ispalindrome(buf1) == 1 and ispalindrome(buf2) == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().strip()
l = len(s)

half = l // 2

left = s[:half]

if half * 2 == l:
    right = s[half:]
else:
    right = s[half+1:]


def is_pal(string):
    return string == string[::-1]


if is_pal(s) and is_pal(left) and is_pal(right):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  s = input()
  if s != s[::-1]:
    print('No')
    return
  a = s[:(len(s)-1)//2]
  if a != a[::-1]:
    print('No')
    return
  b = s[(len(s)+1)//2:]
  if b != b[::-1]:
    print('No')
    return
  print('Yes')
  return

main()

Submission status: Accepted

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

Submission status: Accepted

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

if not S == S[::-1]:
    print('No')
    sys.exit()

s1 = S[0:(N - 1)//2]
if not s1 == s1[::-1]:
    print('No')
    sys.exit()

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

print('Yes')

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]
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:
s=input()
s_r = s[::-1]
n = len(s)
s1 = s[:(n-1)//2]
s1_r = s1[::-1]
s2 = s[(n+3)//2 - 1:]
s2_r =s2[::-1]

if s == s_r and s1 == s1_r and s2 == s2_r:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sun Mar 22 11:54:41 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

s = ns()
n = len(s)
flag = True
for i in range((n - 1) // 2):
    p = (n - 1) // 2
    if s[i] != s[p - i - 1]:
        flag = False

for i in range((n + 3) // 2 - 1, n):
    p = n
    if s[i] != s[p - i - 1]:
        flag = False

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

Submission status: Accepted

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

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


def solve(S: str):
    for i in range(int((len(S) - 1) / 2)):
        if not (S[i] == S[int((len(S) - 1) / 2) - 1 - i] and S[i] == S[int((len(S) - 1) / 2) + 1 + i] and S[i] == S[len(S) - 1 - i]):
            print(NO)
            return
    print(YES)


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

Submission status: Accepted

Solution code:
def fun(S):
    return True if S == S[::-1] else False
    
S = input()
tmp = len(S)//2
if fun(S) and fun(S[:tmp]) and fun(S[tmp+1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy
s = list(input())
n = len(s)
k = copy.deepcopy(s)
k.reverse()
if k != s:
    print("No")
    exit()
formar = copy.deepcopy(s[:(n-1)//2])
q = copy.deepcopy(formar)
q.reverse()
if q != formar:
    print("No")
    exit()
last = copy.deepcopy(s[(n+3)//2 - 1:])
k = copy.deepcopy(last)
k.reverse()
if last != k:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def isstrong(s):
    n = len(s)
    if s != s[::-1]: return False
    s1 = s[0:(n - 1)//2]
    s2 = s[(n + 1) // 2:]
    #print(s1)
    #print(s2)
    if s1 != s1[::-1]: return False
    if s2 != s2[::-1]: return False
    return True

s = input()
if isstrong(s):
    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 i in range((N // 2) // 2):
    if S[i] != S[(N // 2) - 1 - i]: ans = 'No'
    if S[((N + 1) // 2) + i] != S[N - 1 - i]: ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    idx_a = ((N - 1) // 2)
    idx_b = ((N + 3) // 2) - 1
    A = S[:idx_a]
    B = S[idx_b:]
    if S == S[::-1] and A == A[::-1] and B == B[::-1]:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

def is_rotate(s: str) -> bool:
    is_r = True
    for i in range(len(s)//2):
        if s[i] != s[len(s)-1-i]:
            is_r = False
    #print(s, is_r)
    return is_r

N = len(S)
ans = 'No'
if is_rotate(S) and is_rotate(S[:(N-1)//2]) and is_rotate(S[(N+3)//2 - 1:]):
    ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

S= one_str()

flg1=False
flg2=False
flg3=False
N=len(S)

if S==S[::-1]:
    flg1=True
    
flg2_s = S[:(N-1)//2]
if flg2_s == flg2_s[::-1]:
    flg2=True

flg3_s = S[(N+3)//2 -1:]
if flg3_s == flg3_s[::-1]:
    flg3=True

if flg1 and flg2 and flg3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=raw_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:
import sys
# input = sys.stdin.buffer.readline
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

S = input()
n = len(S)

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

if kaibun(S) and kaibun(S[:n//2]) and kaibun(S[n//2+1:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input().strip()

def check(s):
    t = len(s)
    for i in range(0, t // 2):
        if s[i] != s[t - 1 - i]:
            return False

    return True

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

Submission status: Accepted

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

l = 0
r = N-1

def check(t):
    l = 0
    N = len(t)
    r = N-1
    while l<=r:
#        print(t[l],t[r])
        if t[l] == t[r]:
            l+=1
            r-=1
            continue
        return False
    return True

if check(S) and check(S[:N//2]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8


S = input()

N = len(S)
K = N // 2


def is_kaibun(S):
    N = len(S)
    K = N // 2

    for i in range(0, K):
        if S[i] != S[N-1-i]:
            return False
    
    return True


former = S[:K]
latter = S[K+1:]

if is_kaibun(S) and is_kaibun(former) and is_kaibun(latter):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S = input()
N = len(S)
S_head = S[:(N-1)//2]
S_tail = S[(N+3)//2-1:]
if is_palindrome(S) and is_palindrome(S_head) and is_palindrome(S_tail):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()
flag = True
if s != s[::-1]:
    flag =False

tmp=s[:(len(s)-1)//2:]
#print(tmp, tmp[::-1])
if flag and tmp == tmp[::-1]:
    pass
else:
    flag=False

tmp=s[(len(s)+3)//2-1::]
#print(tmp, tmp[::-1])
if flag and tmp == tmp[::-1]:
    pass
else:
    flag=False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def pale(string):
    return 1 if string==string[::-1] else 0

S = (input())
N = len(S)
tmp1 = S[:(N-1)//2]
##print(tmp1)
tmp2 = S[(N+3)//2-1:]
##print(tmp2)
if pale(S) and pale(tmp1) and pale(tmp2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

def is_palindrome(S):
	N = len(S)
	H = N // 2
#	print(S, S[:H], "".join(reversed(S[N - H:])))
	if S[:H] != "".join(reversed(S[N - H:])):
		return False
	return True


def check(S):
	N = len(S)
	if not is_palindrome(S):
		return False
	if not is_palindrome(S[:(N - 1) // 2]):
		return False
	if not is_palindrome(S[(N + 3) // 2 - 1:]):
		return False
	return True

if check(S):
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s=input()

ss=s[::-1]

if ss!=s:
    print("No")
    exit()

t=s[:(len(s)-1)//2]
tt=t[::-1]
if tt!=t:
    print("No")
    exit()

u=s[(len(s)+1)//2:]
uu=u[::-1]
if uu!=u:
    print("No")
    exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
 
x=s[:(n-1)//2]

y=s[(n+1)//2:]

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

Submission status: Accepted

Solution code:
import sys
S = list(input())
N = len(S)
S_r = list(reversed(S))
if S == S_r:
    # (N-1)/2を抜き出す
    S_2 = S[:int((N-1)/2)]
    S_2_r = list(reversed(S_2))
    if S_2 == S_2_r:
        S_3 = S[int((N+3/2)):N]
        S_3_r = list(reversed(S_3))
        if S_3 == S_3_r:
            print('Yes')
            sys.exit()
print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    s = S()
    def f(s):

        for i in range(len(s)):
            if s[i] == s[-i - 1]:
                continue
            return False
        return True
    ans = f(s) and f(s[: (len(s) - 1) // 2]) and f(s[(len(s) + 3) // 2 - 1:])
    print("Yes" if ans else "No")
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if S != S[::-1]:
    print('No')
else:
    N = len(S)
    sub1 = S[:(N - 1) // 2]
    sub2 = S[-(N - 1) // 2:]
    if sub1 != sub1[::-1]:
        print('No')
    elif sub2 != sub2[::-1]:
        print('No')
    else:
        print('Yes')

Submission status: Accepted

Solution code:
s = input().strip()

l = len(s)
s1 = s[0: (l - 1)//2]
s2 = s[(l + 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:
import sys
S=input()
n=len(S)
a=(n-1)//2
for i in range(a//2):
    if S[i]!=S[a-1-i]:
        print("No")
        sys.exit()
if S[:a]==S[a+1:]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
def resolve():
    S = input()
    N = len(S)
    pre = S[0:math.floor((N-1)/2)]
    post = S[math.floor((N+3)/2 - 1):]
    if S == S[::-1] and pre == pre[::-1] and post == post[::-1]:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def read():
    S = input()
    return S,

def is_palindrome(x):
    n = len(x)
    for i in range(n):
        if x[i] != x[n-1-i]:
            return False
    return True

def solve(S):
    N = len(S)
    a = S[:N//2]
    b = S[N//2+1:]
    if is_palindrome(S) & is_palindrome(a) & is_palindrome(b):
        return 'Yes'
    else:
        return 'No'

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x1 = s[:n//2]
x2 = s[n//2+1:]

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
n2 = n // 2

print("Yes" if s[:n2] == s[:n2][::-1] == s[-n2:] else "No")

Submission status: Accepted

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

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