1. 程式人生 > >python 牛客真題 統計迴文

python 牛客真題 統計迴文

s=input()
t=input()
def judge(s):
    ls=len(s)
    for i in range(ls//2):
        if s[i] != s[ls-1-i]:
            return False 
    return True 
cnt=0
for i in range(len(s)+1):
    if judge(s[:i]+t+s[i:]): cnt+=1
print(cnt)