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:
def main():

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

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

    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
S = s[::-1]
n = len(s)
#print(s, n)
i = int(((n-1)/2)-1)
j = int(((n+3)/2)-1)
#print(i, j)
l = s[:i+1]
l2 = l[::-1]
r = s[j:]
r2 = r[::-1]
#print(l, l2, r, r2)
if l == l2 and r == r2 and s == S:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import sys
S=input()
N=len(S)
S1=list(S[0:(N-1)//2])
S2=list(S[(N+3)//2-1:])
S=list(S)
S.pop(N//2)
if(len(S1)%2==1):
    S1.pop(len(S1)//2)

if(len(S2)%2==1):
    S2.pop(len(S2)//2)

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

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

for i,s in enumerate(S2):
    if(s!=S2[-1-i]):
        print('No')
        sys.exit()
        
print('Yes')

Submission status: Accepted

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

a = (len(s) - 1) // 2
b = (len(s) + 3) // 2 - 1
aa = s[0: a]
bb = s[b:]

if aa == bb:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
n=len(s)
r=reversed(s)
f=s[0:(n-1)//2]
l=s[(n+3)//2-1:n]
rf=reversed(f)
rl=reversed(l)
a="".join(s)
b="".join(r)
c="".join(f)
d="".join(rf)
e="".join(l)
f1="".join(rl)
if a==b and c==d and e==f1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

end = len(S)
half = int(end/2)

for i in range(0,half):
    if S[i] is not S[half-1-i]:
        print("No")
        exit()
        
S1 = S[0:half]
S2 = S[half+1:end]

if S1 == S2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def solver():
    S = list(input())
    n = len(S)
    a = (n - 1) // 2
    b = (n + 3) // 2
    s1 = S[:a]
    s3 = S[b-1:]
    if S == S[::-1]:
        if s1 == s1[::-1]:
            if s3 == s3[::-1]:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')

if __name__ == '__main__':
    solver()

Submission status: Accepted

Solution code:
S=list(input())
N=len(S)
fro=S[0:(N-1)//2]
bac=S[(N+3)//2-1:N]
if fro==bac:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
s = input()
s_len = len(s)
s_rev = s[::-1]

if s != s_rev:
  print('No')
  sys.exit()

s_bf_p = int((s_len-1)/2)
s_bf = s[0:s_bf_p]
s_bf_rev = s_bf[::-1]

if s_bf != s_bf_rev:
  print('No')
  sys.exit()

s_af_p = int((s_len+3)/2 - 1)
s_af = s[s_af_p:s_len]
s_af_rev = s_af[::-1]

if s_af != s_af_rev:
  print('No')
  sys.exit()

print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
N = len(S)
def strong(word):
    n = len(word)
    flag = True
    for i in range(n):
        if word[i] != word[-i-1]:
            flag = False
            break
        else:
            continue
    return flag
if strong(S) and strong(S[0:int((N-1)/2)]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys

s = input()
n = len(s)
center_num_pre = (n - 1) // 2

flag = "Yes"
for i in range(center_num_pre):
    #print("one")
    #print(s[i], s[(n - 1) - i])
    if s[i] != s[(n - 1) - i]:
        flag = "No"
        break

if flag == "No":
    print(flag)
    sys.exit()
    
for i in range(center_num_pre // 2):
    #print("two")
    #print(s[i], s[(center_num_pre - 1) - i])
    if s[i] != s[(center_num_pre - 1) - i]:
        #print("baka")
        flag = "No"
        break
    
if flag == "No":
    print(flag)
    sys.exit()
    
for i in range(center_num_pre // 2):
    #print("tree")
    #print(s[i],s[(n - 1) - i])
    if s[i] != s[(n - 1) - i]:
        flag = "No"
        break

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

Submission status: Accepted

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

S = input()
N = len(S)
a = S[: int((N - 1) / 2)]
b = S[int((N + 3) / 2) - 1 :]
ans = "Yes" if S == S[::-1] and a == a[::-1] and b == b[::-1] else "No"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = [c for c in input()]
N = len(S) - 1
s1 = S[:(N-1)//2 + 1]
s2 = S[(N+3)//2:]

rs = list(reversed(S))
rs1 = list(reversed(s1))
rs2 = list(reversed(s2))
if S == rs and s1 == rs1 and s2 == rs2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
flag = 0
for i in range(-(-len(s)//(2))):
    if s[i] != s[len(s)-1-i]:
        flag = 1
s1 = s[0:-(-len(s)//(2))-1]
s2 = s[-(-len(s)//(2)):len(s)]
for i in range(-(-len(s1)//(2))):
    if s1[i] != s1[len(s1)-1-i]:
        flag = 1
for i in range(-(-len(s2)//(2))):
    if s2[i] != s2[len(s2)-1-i]:
        flag = 1
if flag == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=input()
a=list(a)
a1=[]
b1=[]
c1=[]
for i in range(len(a)-1,-1,-1):
    a1.append(a[i])
b=a[0:(len(a)-1)//2]
for i in range(len(b)-1,-1,-1):
    b1.append(a[i])
c=a[(len(a)+3)//2-1:len(a)]
for i in range(len(c)-1,-1,-1):
    c1.append(a[i])



if(a==a1):
    if(b==b1 and c==c1):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
S = input()

halfLength = len(S) // 2
mae = S[:halfLength] 
ushiro = ''.join(list(reversed(S[halfLength+ 1:])))
answer = 'No'
if mae == ushiro:
    mae_halflen =  len(mae) // 2
    mae_mae = mae[mae_halflen:] 
    mae_ushiro = ''.join(list(reversed(mae[:mae_halflen + len(mae) % 2])))
    if (mae_mae == mae_ushiro):
         answer = 'Yes'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def checkPalindrome(string):
    string_len = len(string)
    for i in range(int(string_len/ 2)):
        if(string[i] != string[string_len - i - 1]):
            return False
    return True

S = input()
string_len = len(S)
if(checkPalindrome(S) and checkPalindrome(S[:int((string_len-1)/2)]) and checkPalindrome(S[int((string_len + 3)/2-1):])):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = list(input())
S_reverse1 = list(reversed(S))

flag = 0
if S == S_reverse1:
  flag += 1

S_reverse2 = list(reversed(S[: (len(S) - 1) // 2]))
S_reverse3 = list(reversed(S[(len(S) + 1) // 2 :]))

if S_reverse2 == S[: (len(S) - 1) // 2] and S_reverse3 == S[(len(S) + 1) // 2 :]:
  flag += 1
  
if flag == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

if tmp1 !="".join(list(reversed(tmp1))):
    print("No")
elif tmp2 !="".join(list(reversed(tmp2))):
    print("No")
elif s !="".join(list(reversed(s))):
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
n1 = (N - 1) // 2
n2 = (N + 3) // 2

res1 = S[:n1]
res2 = S[n2-1:]

if(S == list(reversed(S)) and res1 == list(reversed(res1)) and res2 == list(reversed(res2))):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
left = S[:N // 2]
right = S[N // 2 + 1:]
last = S[(N+3)//2-1:]

print('Yes') if S == S[::-1] and left == left[::-1] and right == right[::-1] and last == last[::-1] else print('No')

Submission status: Accepted

Solution code:
S=input()
N=len(S)
ans=0
A=list(S[0:N//2])
B=list(S[N//2+1:])
A_R=list(reversed(A))
B_R=list(reversed(B))
if A==B and A==A_R and B==B_R:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def check1(s):
    if len(s) % 2 == 1:
        return True
    else:
        return False


def helper(s):
    if len(s) % 2 == 0:
        return _helper_even(s)
    else:
        return _helper_odd(s)


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

    for c1, c2 in zip(s1, s2):
        if c1 != c2:
            return False
    else:
        return True


def _helper_even(s):
    center = int(len(s) / 2)
    s1 = s[:center]
    s2 = s[center:]
    s2 = s2[::-1]

    for c1, c2 in zip(s1, s2):
        if c1 != c2:
            return False
    else:
        return True


def check2(s):
    if not helper(s):
        return False

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

    if not helper(s1):
        return False
    if not helper(s2):
        return False

    return True


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

    if check1(s) and check2(s):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def judge(S):
    N = len(S)
    if S[:(N-1)//2] != S[(N+1)//2:][::-1]:
        return False
    elif S[:(N-1)//2] != S[(N+1)//2:]:
        return False
    else:
        return True


S = input()
if judge(S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

S0 = [i for i in input()]

n = len(S0)
m = (n-1)/2
S1 = S0[:int((n-1)/2)]
S2 = S0[int((n+3)/2)-1:]


if palindrome(S0) + palindrome(S1) +palindrome(S2) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()

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

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.stdin = open('input.txt')

def ispPlindrome(s):
    if len(s) <= 1:
        return True
    else:
        return s[0] == s[-1] and ispPlindrome(s[1:-1])

s = input()
n = len(s)

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

Submission status: Accepted

Solution code:
import math


def kaibun_check(texts):
    n = len(texts)
    if texts == texts[::-1]:
        return True
    return False


def main():
    S = list(input())
    N = len(S)
    if not kaibun_check(S):
        print("No")
        return
    if not kaibun_check(S[0:(N - 1) // 2]):
        print("No")
        return
    if not kaibun_check(S[math.ceil((N + 3) / 2) - 1:]):
        print("No")
        return
    print("Yes")
    return


main()

Submission status: Accepted

Solution code:
import sys
S = list(str(input()))
length = len(S)

half = int((length-1)/2)
halfhalf = int(half/2)
condition3 = int((length+3)/2)

for i in range(half):
    if S[i] != S[-i-1]:
        print("No")
        sys.exit()
halfS = S[:half]
if len(halfS) == 1:
    pass
else:
    for i in range(halfhalf):
        if halfS[i] != halfS[-i-1]:
            print("No")
            sys.exit()

S3 = S[condition3-1:]
if len(S3) == 1:
    pass
else:
    half_S3 = int(len(S3)/2)
    for i in range(half_S3):
        if S3[i] != S3[-i-1]:
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

f = 0


def judge(S):
    print()
    if S[:len(S)//2]==S[:len(S)//2+len(S)%2-1:-1]:
        return True
    else:
        return False


if judge(S) and judge(S[:len(S)//2]) and judge(S[len(S)//2+len(S)%2:]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
result = "Yes"
for i in range((N+1)//2):
    if S[i] != S[N-1-i]:
        result = "No"
        break

if result == "Yes":
    for i in range((N+1)//4):
        if S[i] != S[(N-1)//2-1-i]:
            result = "No"
            break
    
if result == "Yes":
    for i in range((N-(N+3)//2+2)//2):
        if S[(N+3)//2-1+i] != S[N-1-i]:
            result = "No"
            break
    
print(result)

Submission status: Accepted

Solution code:
s = input()
r = "".join(reversed(s))
if s != r:
    print("No")
else:
    a = (len(s)-1)//2
    b = (len(s)+3)//2 - 1
    te = "".join(reversed(s[:a]))
    te2 = "".join(reversed(s[b:]))
    if s[:a] == te and s[b:] == te2:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
a=input()
import sys
if len(a)%2==0:
    print('No')
    sys.exit()
d=(len(a)-1)//2

b=a[0:int(d)]
e=(len(a)+3)/2-1
c=a[int(e):int(len(a))]
r=['']*len(b)
w=['']*len(c)
for i in range(len(b)):
    r[i]+=b[i]
for i in range(len(c)):
    w[i]+=c[i]

b1=r
b1.reverse()
c1=w
c1.reverse()

if b1==r and c1==w and r==w:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
a=0;b=0;c=0
S=list(input())
N=len(S)
T=S[:]
S.reverse()
#print(S)
#print(T)
if S==T:
  a=1

x=(N-1)//2
y=(N+2)//2
X=S[0:x]
X1=X[:]
X.reverse()
if X==X1:
  b=1
Y=S[y:N]
Y1=Y[:]
Y.reverse()
if Y==Y1:
  c=1
#print(X,X1)
#print(Y,Y1)
if a*b*c==1:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

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

def main():
    S = input()

    N = len(S)

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

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

# %%
# from atcoder_test import doTest
# doTest("abc159","b",main)

Submission status: Accepted

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

if s[:N//2] !=  s[:N//2][::-1]:
    ok = False
#print(s[:N//2], s[:N//2][::-1])

if s[N//2+1:] != s[N//2+1:][::-1]:
    ok = False

#print(s[N//2+1:] , s[N//2+1][::-1])
if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
S = input()

n = len(S)

if S == S[::-1]:
  a = (n-1)//2
  b = (n+1)//2
  s1 = S[0:a]
  s2 = S[b:n]
  if s1 == s1[::-1] and s2 == s2[::-1]:
    print("Yes")
    sys.exit()
print("No")

Submission status: Accepted

Solution code:
S = input()
half_l = int((len(S) -1)/2)
mae = S[0:half_l]
ato = S[half_l+1:len(S)]

start = int((len(S) +3)/2)
target_str = S[start-1:len(S)]

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

if not ispalindrome(S):
    print('No')
    exit(0)

if not ispalindrome(mae):
    print('No')
    exit(0)

if not ispalindrome(target_str):
    print('No')
    exit(0)
print('Yes')

Submission status: Accepted

Solution code:
import sys

S = list(input())

N = len(S)

S1 = S[:int((N-1)/2)]
S2 = S[int((N+3)/2-1):]

#print(S1, S2)

if S == S[::-1]:
    if S1 == S1[::-1]:
        if S2 == S2[::-1]:
            print("Yes")
            sys.exit()

print("No")

Submission status: Accepted

Solution code:
import math
import sys 
s = input()
if s==s[::-1]:
    n = len(s)
    right = int((n-1)/2)
    tmp = s[:right]
    if tmp == tmp[::-1]:
        left = int((n+3)/2)
        tmp2 = s[left-1:]
        if tmp2 == tmp2[::-1]:
            print('Yes')
            sys.exit()
print('No')

Submission status: Accepted

Solution code:
def R(S):
    return "".join(reversed([c for c in S]))

def solve(S):
    l = len(S)
    if not S == R(S):
        return False
    if not S[0: (l - 1) // 2] == R(S[0: (l - 1) // 2]):
        return False
    if not S[(l - 1) // 2 + 1:] == R(S[(l - 1) // 2 + 1:]):
        return False

    return True

def main():
    if solve(input()):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

first = (len(s)-1)//2
sec = (len(s)+3)//2

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

Submission status: Accepted

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


def isPalindrome(s: str):
    return list(s) == list(reversed(s))

S = input()
N = len(S)

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

if all([isPalindrome(x) for x in [S, s2, s3]]):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

s = input()

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

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
T = [i for i in S[::-1]]
U = []
for i in range(int((N-1)/2)):
    U.append(S[i])
V = [i for i in U[::-1]]
W = []
for i in range(int((N + 3)/2 -1),N):
    W.append(S[i])
X = [i for i in W[::-1]]
if S != T:
    print('No')
elif U != V:
    print('No')
elif W != X:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
l = len(s)
c = (l-1)//2

count = 0
check = 0
for i in range(0,c-1):
  if s[i] == s[l-i-1]:
    count = count + 1
    
if count == c-1:
  check = check + 1

count1 = 0  
for j in range(0, c-1):
  if s[j] == s[c-j-1]:
    count1 = count1 + 1

if count1 == c-1:
  check = check + 1

if check == 2:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s=list(input())
flg=1
n=len(s)
s_reverse=list(reversed(s))
if s!=s_reverse:
    flg=0
s_2=s[:int((n-1)/2)]
s_2_reverse=list(reversed(s_2))
if s_2!=s_2_reverse:
    flg=0
s_3=s[int((n+3)/2)-1:]
s_3_reverse=list(reversed(s_3))
if s_3!=s_3_reverse:
    flg=0
if flg==0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s=input()
n=len(s)
judge=True
for i in range(int((n+1)/2),n):
  if s[i]==s[i-int((n+1)/2)]:
    pass
  else:
    print("No")
    judge=False
    sys.exit()
if judge==True:
  print("Yes")

Submission status: Accepted

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

def palind(word):
  word = word.lower()
  return word[::-1] ==word

num1 = int((N-1)/2)
num2 = int((N+3)/2)

text1 =S[0::num1]
text2 =S[num2-1::]

if palind(S) == True and palind(text1) == True and palind(text2) == True:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
def check(s):
  n=len(s)
  if s!=s[::-1]:
    return "No"
  temp=s[:(n-1)//2]
  if temp!=temp[::-1]:
    return "No"
  temp=s[((n+3)//2)-1:]
  if temp!=temp[::-1]:
    return "No"
  return "Yes"
s=input()
print(check(s))

Submission status: Accepted

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

s = input()
if is_kaibun(s):
    half_len = int((len(s) - 1) / 2)
    half_s = s[:half_len]
    if is_kaibun(half_s):
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

# if len(S) % 2 != 0:

half_num = len(S) // 2
front = S[:half_num]
back = S[half_num+1:]


is_true = True
if front == back:
    for idx in range((len(S)-1)//2):
        if S[idx] != S[-(idx+1)]:
            is_true = False
else:
    is_true = False

if is_true:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

def check(a):
    n = len(a)
    m = len(a) // 2
    for i in range(m):
        if a[i] != a[n - i - 1]:
            return False
    else:
        return True

m_1 = (len(s) - 1) // 2
m_2 = m_1 + 1
ans = 'Yes' if check(s) and check(s[:m_1]) and check(s[m_2:]) else 'No'

print(ans)

Submission status: Accepted

Solution code:
text = input()
index = (len(text)-1)//2

if text[::-1] == text and text[:index][::-1] == text[:index] and text[index+1:][::-1] == text[index+1:]:
    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)

i1 = int((N-1)/2)
i2 = int((N+3)/2)-1
strong = True
if not ispalindrome(S):
  strong = False
if not ispalindrome(S[:i1]):
  strong = False
if not ispalindrome(S[i2:]):
  strong = False

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

Submission status: Accepted

Solution code:

S = input()
N = int(len(S))

S_inv = S[::-1]

S_mae = S[:int((N-1)/2)]
S_mae_inv = S_mae[::-1]

S_ushiro = S[int((N+1)/2):]
S_ushiro_inv = S_ushiro[::-1]

if (S == S_inv and S_mae == S_mae_inv and S_ushiro == S_ushiro_inv):
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = 'Yes'
if s != s[::-1]:
    ans = 'No'
seq1 = int((n - 1) / 2)
if s[:seq1] != s[seq1-1::-1]:
    ans = 'No'
seq2 = int((n + 3) / 2)
if s[seq2-1:] != s[n:seq2-2:-1]:
    ans = 'No'
print(ans)

Submission status: Accepted

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

def kai(s):
  n = len(s)
  if n % 2 != 0:
    if s[:int((n-1)/2)] == s[int((n+1)/2):][::-1]:
      return True
    else:
      return False
  else:
    if s[:int(n/2)] == s[int(n/2):][::-1]:
      return True
    else:
      return False

s1 = s[:int((n-1)/2)]
s2 = s[int((n+1)/2):]
#print(s, s1, s2)
#print([kai(s),kai(s1),kai(s2)])
if sum([kai(s),kai(s1),kai(s2)]*1) == 3:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    if not kaibun(s) :
        print('No')
        return
    n = len(s)
    n1 = (n - 1) // 2
    if not kaibun(s[:n1]) :
        print('No')
        return
    n2 = (n + 3) // 2 - 1
    if not kaibun(s[n2:]) :
        print('No')
        return
    print('Yes')

def kaibun(str):
    return True if str == str[::-1] else False

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def is_kaibun(s):
    for i in range(len(s) // 2):
        if s[i] != s[-i-1]:
            print('No')
            exit()

N = len(S)
is_kaibun(S)
is_kaibun(S[:(N-1)//2])
is_kaibun(S[(N+3)//2-1:])
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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


s = input()
n = len(s)
ans = "Yes"
if (
    not is_palindrome(s)
    or not is_palindrome(s[0 : (n - 1) // 2])
    or not is_palindrome(s[(n + 3 - 1) // 2 :])
):
    ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()
Flg = "Yes"

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

Submission status: Accepted

Solution code:
S = input()

halfLen = len(S)//2

if halfLen % 2 == 1 and S[0:halfLen//2] == S[halfLen//2+1:halfLen][::-1] and S[halfLen+1:halfLen+1+halfLen//2] == S[len(S)-halfLen//2:len(S)][::-1] and S[0:halfLen] == S[halfLen+1:len(S)][::-1]:
  print('Yes')
elif halfLen % 2 == 0 and S[0:halfLen//2] == S[halfLen//2:halfLen][::-1] and S[halfLen+1:halfLen+1+halfLen//2] == S[len(S)-halfLen//2:len(S)][::-1] and S[0:halfLen] == S[halfLen+1:len(S)][::-1]:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def is_pali(s, start, end):
	cpy = s[start:end]
	rev = cpy[::-1]
	if cpy == rev:
		return 1
	else:
		return 0

s = input()
n = len(s)
if is_pali(s, 0, n) and is_pali(s, 0, (n - 1) // 2) and is_pali(s, ((n + 3) // 2) - 1, n):
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
def kaibun(s):
    flg = True
    i, j = 0, len(s)-1
    while i <= j:
        if s[i] != s[j]:
            flg = False
        i += 1
        j -= 1
    return flg


sr = input()
n = len(sr)
flg = kaibun(sr)
s2 = sr[:(n-1)//2]
flg *= kaibun(s2)
s3 = sr[(n+3)//2-1:]
flg *= kaibun(s3)
if flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

    S = input()[:-1]

    zenhan = S[0:int(len(S)/2)]
    kouhan = S[int(len(S)-((len(S)-1)/2)):]

    #1
    if zenhan == kouhan[::-1]:
        zenhan_z = zenhan[0:int(len(zenhan)/2)]
        zenhan_k = zenhan[int(len(zenhan)-((len(zenhan)-1)/2)):]
        if zenhan_z == zenhan_k[::-1]:
            kouhan_z = kouhan[0:int(len(kouhan)/2)]
            kouhan_k = kouhan[int(len(kouhan)-((len(kouhan)-1)/2)):]
            if kouhan_z == kouhan_k[::-1]:
                print("Yes")
                return
    
    print("No")

    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = list(input())
t = s[::-1]
n = len(s)
if s != t:
  print ('No')
  exit()
if n == 3:
  print('Yes')
  exit()
d = s[:int((n-1)/2)]
e = d[::-1]
#print(d,e)
r = s[int((n+3)/2-1):]
q = r[::-1]
#print(r,q)
if d != e:
  print('No')
  exit()
if r != q:
  print ('No')
  exit()
  
print('Yes')

Submission status: Accepted

Solution code:
S = input()

cond1 = False #Sが回文
cond2 = False #前半分が回文
cond3 = False #後半分が回文

N = len(S)
end_full = int(((N+1)/2)-1)

if S[0:end_full]==S[::-1][0:end_full]:
  cond1 = True

half_N = len(S[0:end_full])
#print("half_N",half_N)

if half_N%2==0:
  half_end = int(half_N/2)
else:
  half_end = int(((half_N+1)/2)-1)
#print("half_end",half_end)

prevS = S[0:end_full]
#print("prevS1",prevS[0:half_end])
#print("prevS2",prevS[::-1][0:half_end])
if prevS[0:half_end]==prevS[::-1][0:half_end]:
  cond2 = True
  
suffS = S[::-1][0:end_full]
if suffS[0:half_end]==suffS[::-1][0:half_end]:
  cond3 = True
  
if cond1 and cond2 and cond3:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

def solve(N, S):
    
    if S == S[::-1]:
        # 回文である
        hoge = S[:int((N-1)/2)]
        hoge2 = S[int((N+3)/2)-1:N]
        
        if hoge == hoge[::-1] and hoge2 == hoge[::-1]:
            return "Yes"
    return "No"

print(solve(N, S))

Submission status: Accepted

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

s = input().replace("\n","")

reverse_s = s[::-1]

s1len = int((len(s)/2))

s1 = s[:s1len]
reverse_s1 = s1[::-1]
# print(s1)

s2len = int((len(s)/2) + 1)
s2 = s[s2len:]
reverse_s2 = s2[::-1]
# print(s2)


if (s == reverse_s) and (s1 == reverse_s1) and (s2 == reverse_s2):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
s_1 = s[0:(n-1)//2]
s_2 = s[(n+1)//2:n]


def kaibunn(l):
    a = 1
    m = len(l)
    for i in range(m):
        if l[i] != l[m-1-i]:
            a = 0
            break
    return a

if kaibunn(s)==1 and kaibunn(s_1)==1 and kaibunn(s_2)==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

s = input().rstrip()
n = len(s)

r_s = ''
for c in reversed(s):
    r_s = r_s + c

if s != r_s:
    print('No')
    sys.exit()

top = ''
for i in range(int((n - 1)/2)):
    top = top + s[i]

r_top = ''
for c in reversed(top):
    r_top = r_top + c

if top != r_top:
    print('No')
    sys.exit()

last = ''
for i in range(int((n + 3)/2) - 1, n):
    last = last + s[i]

r_last = ''
for c in reversed(last):
    r_last = r_last + c

if r_last != last:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

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

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