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
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def is_ok(S):
    N = len(S)
    for i in range(N):
        if S[i]!=S[-i-1]:
            return False
    return True
def main():
    S=ST()
    N=len(S)
    a = is_ok(S[:(N-1)//2])
    b = is_ok(S[(N+3)//2-1:])
    c = is_ok(S)
    # print(S[:(N-1)//2],S[(N+3)//2-1:])
    if(a and b and c):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Submission status: Accepted

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


def solve():
    S = input()
    reverse_S = list(reversed(S))
    for i in range(len(S)):
        if S[i] != reverse_S[i]:
            print('No')
            exit()
    s2 = S[:(len(S) - 1) // 2]
    reverse_s2 = list(reversed(s2))
    for i in range(len(s2)):
        if s2[i] != reverse_s2[i]:
            print('No')
            exit()
    s3 = S[(len(S) + 3) // 2 - 1:]
    reverse_s3 = list(reversed(s3))
    for i in range(len(s3)):
        if s3[i] != reverse_s3[i]:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = input()

a = s[:(len(s)-1)//2]
b = s[(len(s)+2)//2:]

for i in range(len(a)):
    if a[i] != a[-i-1]:
        print("No")
        exit()

for i in range(len(b)):
    if b[i] != b[-i-1]:
        print("No")
        exit()

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

print("Yes")

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


S = input()
N = len(S)
flag = True
for i in range(N // 2):
    if S[i] == S[N - i - 1]:
        continue
    else:
        flag = False

if flag:
    S1 = S[: (N - 1) // 2]
    N = len(S1)
    for i in range(N // 2):
        if S1[i] == S1[N - i - 1]:
            continue
        else:
            flag = False

if flag:
    S2 = S[(len(S) + 3) // 2 - 1 :]
    N = len(S2)
    for i in range(N // 2):
        if S2[i] == S2[N - i - 1]:
            continue
        else:
            flag = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

l = (n - 1) // 2
r = (n + 3) // 2

left = s[:l]
right = s[r - 1:]

if s == list(reversed(s)) and left == list(reversed(left)) and right == list(reversed(right)):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def fn1(s):
	return s == s[::-1]
def fn2(s):
	n = len(s)
	x = s[:(n-1)//2]
	return x == x[::-1]
def fn3(s):
	n = len(s)
	x = s[(n+1)//2:]
	return x == x[::-1]

s = input()

if fn1(s) and fn2(s) and fn3(s):
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
N = len(S)
a = S[:(N - 1) // 2]
b =  S[(N + 1) // 2 :]
# print(a, b)
# print(a[::-1], b[::-1])
if S == S[::-1] and a == a[::-1] and b == b[::-1]:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    n = len(s)
    for i in range(n//2):
        if s[i] == s[-(i+1)]:
            continue
        else:
            print('No')
            return
    s1 = s[:n//2]
    for i in range(len(s1)//2):
        if s1[i] == s1[-(i+1)]:
            continue
        else:
            print('No')
            return

    s1 = []
    s1 = s[n//2 + 1:]
    for i in range(len(s1)//2):
        if s1[i] == s1[-(i+1)]:
            continue
        else:
            print('No')
            return

    print('Yes')

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
flg = True

if s != s[::-1]:
    flg = False
    
part1 = s[0:int((len(s)-1)/2)]
if part1 != part1[::-1]:
    flg = False
    
part2 = s[int((len(s)+3)/2 -1):len(s)]
if part2 != part2[::-1]:
    flg = False
    
if flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

index1 = (len(S)-1)//2
index2 = (len(S)+3)//2
S_sub1 = S[:index1]
S_sub2 = S[index2-1:]

if S == S[::-1] and S_sub1 == S_sub1[::-1] and S_sub2 == S_sub2[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

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

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 check(s):
    result = True
    for i in range(len(s)//2):
        if s[i]!=s[-(1+i)]:
            result = False
            break
            
    return result


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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
l = len(s)
if list(s) != list(reversed(s)):
    print('No')
    exit()
if list(s[:(l - 1) // 2]) != list(reversed(s[:(l - 1) // 2])):
    print('No')
    exit()
if list(s[(l + 3) // 2 - 1:l]) != list(reversed(s[(l + 3) // 2 - 1:l])):
    print('No')
    exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()
l = len(S)
ans='Yes'
if S!=S[::-1]:
  ans='No'
if S[:(l-1)//2:]!=S[:(l-1)//2:][::-1]:
  ans='No'
if S[(l+3)//2-1::]!=S[(l+3)//2-1::][::-1]:
  ans='No'
  
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

    isStrong = True
    half = N // 2
    for i in range(N):
        if i < half:
            if S[i] != S[-i-1]:
                isStrong = False
            if S[i] != S[half-i-1]:
                isStrong = False
        else:
            if S[i] != S[N-i-1]:
                isStrong = False

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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[(N-1)//2-i-1]:
    print("No")
    exit()
    
for i in range((N-1)//2):
  if S[(N+3)//2+i-1]!=S[N-i-1]:
    print("No")
    exit()
    
print("Yes")

Submission status: Accepted

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
s = input()
n = len(s)
ss = s[:n//2]
sss = s[-1:-n//2:-1]
if s == s[::-1] and ss == ss[::-1] and sss == sss[::-1]:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
S=input()

N=len(S)


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

Submission status: Accepted

Solution code:
def check(s):
    # print(s)
    for i in range(len(s)):
        if s[i] != s[len(s) - i - 1]:
            return False
    return True

def solve():
    s = input()
    if not check(s):
        return "No"
    # print(s[:(len(s) - 1) // 2 + 1], 111, (len(s) - 1) // 2 + 1, (len(s) + 3)// 2)
    if not (check(s[:(len(s) - 1) // 2])):
        return "No"
    if not check(s[(len(s) + 3)// 2 - 1:]):
        return "No"
    return "Yes"

print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
n=len(s)
flag1=True
flag2=True

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

if b==b[::-1] and c==c[::-1] and s==s[::-1]:
    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):
    N = len(S)
    head = S[:(N-1)//2]
    tail = S[(N-1)//2+1:]

    reversed_head = head[::-1]
    reversed_tail = tail[::-1]
    reversed_S = S[::-1]
    if head == reversed_head and tail == reversed_tail and reversed_S == S:
        print("Yes")
    else:
        print("No")
    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:
def kaibun(S):
    ok=True
    for i in range(len(S)//2):
        if S[i]!=S[-1-i]:
            ok=False
            break
    return ok

S=input()
N=len(S)
ok=True
if not kaibun(S):
    ok=False

if not kaibun(S[0:(N-1)//2]):
    ok=False

if not kaibun(S[(N+1)//2:N]):
    ok=False

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

Submission status: Accepted

Solution code:
S = input()

ans = 0
N = len(S)
if S == S[::-1]:
    ans += 1

s2 = S[0:(N - 1) // 2]
if s2 == s2[::-1]:
    ans += 1

s3 = S[(N + 3) // 2 - 1:N]
if s3 == s3[::-1]:
    ans += 1

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

Submission status: Accepted

Solution code:
def ispalindrome(str): return 1 if str == str[::-1] else 0
s=input()
n=len(s)
if ispalindrome(s)==1:
    x = int((n-1)/2)
    y = int((n+3)/2)
    sx = s[:x]
    sy = s[y-1:]

    if ispalindrome(sx)!=1:
        print('No')
        exit()
    if ispalindrome(sy)!=1:
        print('No')
        exit()
    else:
        print('Yes')
        exit()
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class v:
    def __init__(self, f):
        self.f = f
        self.v = None
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n) 


def f(S):
    for s, t in zip(S, S[::-1]):
        if s != t:
            return False
    return True

def main():
    S = input().strip()
    FS = S[:len(S)// 2]
    BS = S[len(S) // 2 + 1:]
    
    if f(S) and f(FS) and f(BS):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

n = len(S)
ans = "Yes"
if S != S[::-1]:
    ans = "No"
A = S[:(n-1)//2]
if A != A[::-1]:
    ans = "No"

B = S[(n+3)//2-1:]
if B != B[::-1]:
    ans = "No"

print(ans)

Submission status: Accepted

Solution code:
s=list(input())
def kaubun(s):
    f=1
    for i in range(len(s)//2):
        if s[i]!=s[-i]:
            f=0
    if f:
        return True
    else:
        return False

def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True
f1=1 if is_kaibun(s) else 0
f2=1 if is_kaibun(s[:(len(s)-1)//2]) else 0
f3=1 if is_kaibun(s[(len(s)+3)//2-1:]) else 0
if f1 and f2 and f3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
a = list(input())
b = len(a)
print("Yes" if a == a[::-1] and a[:b//2] == a[:b//2:-1] and a[math.ceil(b/2):] == (a[math.ceil(b/2):])[::-1] else "No")

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
ans = 'No'
if S == S[::-1]:
    sub_1 = S[:(N - 1) // 2]
    if sub_1 == sub_1[::-1]:
        sub_2 = S[(N + 2) // 2:]
        if sub_2 == sub_2[::-1]:
            ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
s=input()
n=len(s)
ok=True
for i in range(int(n//2)):
    if s[i]!=s[n-i-1]:
        ok=False

for i in range(int((n//2)//2)):
    if s[i]!=s[n//2-i-1]:
        ok=False

for i in range(int((n//2)//2)):
    if s[n//2+1+i]!=s[n-i-1]:
        ok=False

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

Submission status: Accepted

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

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

if solve(S) and solve(S1) and solve(S2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    S = args[0]
    n = len(S)

    strong = True
    for s in [S, S[:(n-1)//2], S[(n+3)//2-1:]]:
        strong &= s == s[::-1]

    return 'Yes' if strong else 'No'


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

flag = [0] * 3

if s == s[::-1]:
    flag[0] = 1

a = int((n - 1) * 0.5)
sa = s[:a]
if sa == sa[::-1]:
    flag[1] = 1

b = int((n + 3) * 0.5)
sb = s[(b - 1):]
if sb == sb[::-1]:
    flag[2] = 1

if sum(flag) == 3:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
center=len(S)//2
if len(S)%2==0:
    print("No")
else:
    if S[:center]==S[center+1:]:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
S = input()

N = len(S)
l = S[0:(N-1)//2]
r = S[(N+3)//2 - 1:]
if l == r:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
ng=0
for i in range(n//2):
    #print(s[i], s[-i-1])
    if s[i]!=s[-i-1]:
        ng=1

for i in range(((n-1)//2)//2):
    #print(s[i], s[-i-1+(n-1)//2])
    if s[i]!=s[-i-1+(n-1)//2]:
        ng=1

for i in range(((n-1)//2)//2):
    #print(s[i-1+(n+3)//2])
    if s[i-1+(n+3)//2]!=s[-i-1]:
        ng=1

if ng==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def main():
    S = input()
    s = S[:len(S)//2]
    if all(a==b for a,b in zip(S, reversed(S))) and all(a==b for a,b in zip(s, reversed(s))):
        print(Yes)
    else:
        print(No)


main()

Submission status: Accepted

Solution code:
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    l = len(s)
    lh = (l - 1) // 2

    for i in range(lh):
        if s[i] != s[-1 - i]:
            print('No')
            sys.exit()

    s1 = s[0:(l - 1) // 2]
    s2 = s[(l + 1) // 2:]

    lhh = len(s1) // 2

    for i in range(lhh):
        if s1[i] != s[-1 - i]:
            print('No')
            sys.exit()
        if s2[i] != s[-1 -i]:
            print('No')
            sys.exit()

    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

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

    t = s[::-1]
    if s == t:
        u = s[:N//2]
        v = s[N//2+1:]
        if u == u[::-1] and v == v[::-1]:
            print("Yes")
            exit()
    
    print("No")
    

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = raw_input()

N = len(S)

is_flag = True
for i in range(N):
    if S[i] != S[N-1-i]:
        is_flag = False

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


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


if is_flag:
    print "Yes"
else:
    print "No"

Submission status: Accepted

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

ans = True


i = 0
j = mm-1
while(1):
    if i==j or j<i:
        break

    if S[i]!=S[j]:
        ans = False
        break
    i += 1
    j -= 1


i = 0
j = (mm-1)//2-1
while(1):
    if i==j or j<i:
        break
    if S[i]!=S[j]:
        ans = False
        break
    i += 1
    j -= 1


i = (mm+3)//2-1
j = mm-1
while(1):
    # print(S[i],S[j])
    if i==j or j<i:
        break
    if S[i]!=S[j]:
        ans = False
        break
    i += 1
    j -= 1

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

Submission status: Accepted

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

ans = 'Yes'
for i in range((n-1)//2):
    if s[i] != s[n-i-1]:
        ans = 'No'
for i in range((n-1)//2):
    if s[i] != s[(n-1)//2-i-1]:
        ans = 'No'
s_inv = s[::-1]
for i in range((n-1)//2):
    if s_inv[i] != s_inv[(n-1)//2-i-1]:
        ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().strip()
n = len(s)
a = s[:(n - 1) // 2]
b = s[((n + 3) // 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()
n = len(s)
tmp_1 = (n-1) // 2

tmp_2 = (n+3) // 2

tmp_1_s = s[:tmp_1]
tmp_2_s = s[tmp_2-1:n]
if s == s[::-1] and tmp_1_s == tmp_1_s[::-1] and tmp_2_s == tmp_2_s[::-1]:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
def f(c):
    for i in range(len(c)):
        if c[i]!=c[-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:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


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

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

Submission status: Accepted

Solution code:
"""
NTC here
"""
import sys
inp = sys.stdin.readline


def input(): return inp().strip()


flush = sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**25)


def iin(): return int(input())


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

# range = xrange
# input = raw_input


def main():
    def fn(s):
        l = len(s)
        l, r = 0, l-1
        while l<r:
            if s[l]!=s[r]:
                return False
            l+=1
            r-=1
        return True
    s = input()
    n = len(s)
    print("Yes" if fn(s) and fn(s[:n//2]) else "No")

main()
# threading.Thread(target=main).start()

Submission status: Accepted

Solution code:
def solve(S):
    if S != S[::-1]:
        return "No"
    h = (len(S) - 1)//2
    h2 = (len(S) + 3)//2
    A = S[:h]
    B = S[h2-1:]
    if A != A[::-1]:
        return "No"
    if B != B[::-1]:
        return "No"
    return "Yes"


if __name__ == "__main__":
    S = input()
    print(solve(S))

Submission status: Accepted

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

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

Submission status: Accepted

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

def is_pal(X):
    ret = True
    for i in range(len(X)//2+1):
        if X[i] != X[-i-1]:
            ret = False
    return ret


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

Submission status: Accepted

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

s1 = s[:l+1]
s2 = s[r:]

sr = s[::-1]
s1r = s1[::-1]
s2r = s2[::-1]

if s == sr and s1 == s1r and s2 == s2r:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s= input()

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

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

Submission status: Accepted

Solution code:
# ABC159b


def main():
    import sys
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    s = input()
    n = len(s)
    if s != s[::-1]:
        print('No')
        exit(0)
    if s[: (n - 1) // 2] != s[: (n - 1) // 2:-1]:
        print('No')
        exit(0)
    if s[(n+3)//2-1:n] != s[(n+3)//2-1:n][::-1]:
        print('No')
        exit(0)
    print('Yes')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

n = len(s)

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    def p(s):
        for i in range(len(s)):
            if s[i] != s[-i-1]:
                return False
        return True
    N = len(S)
    if p(S) and p(S[:(N-1)//2]) and p(S[(N+3)//2-1:]):
        return 'Yes'
    return 'No'


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = input()
N = len(S)

ans = 'Yes'

mid1 = (N - 1) // 2
mid2 = ((N + 3) // 2) - 1

one = S[:mid1]
two = S[mid2:]


if not(one == one[::-1] and two == two[::-1]):
    ans = 'No'

if not (S == S[::-1]):
    ans = 'No'

print(ans)

Submission status: Accepted

Solution code:


from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs

def r(x):
	return x[::-1]


def main(inputs):
	s=inputs[0][0]
	n=len(s)
	if s[::-1]!=s:
		print("No")
		sys.exit(0)
# 	print(s[0:(n-1)//2])
	if s[0:(n-1)//2]!=r(s[0:(n-1)//2]):
		print("No")
		sys.exit(0)
# 	print(s[(n+3)//2-1:])
	if s[(n+3)//2-1:]!=r(s[(n+3)//2-1:]):
		print("No")
		sys.exit(0)
	print("Yes")
	
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)

Submission status: Accepted

Solution code:
def main():
    S = input()
    def helper(s):
        l, r = 0, len(s) -1
        while l < r:
            if s[l] != s[r]:
                return False
            l += 1
            r -= 1
        return True

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

main()