## 给定字符串,寻找最长回文子串
## 单回文,双回文
def findh(s):
## 单回文
ld,l=[],len(s)
if len(s)<3:
return 'too short'
for i in range(1,l-1):
for j in range(1,min(i+1,l-i)):
if s[i-j]!=s[i+j] and j==1:
break
elif s[i-j]!=s[i+j] and j>1:
ld.append(s[i-j+1:i+j])
break
## 双回文
s='#'+s+'?'
for i in range(1,l):
for j in range(1,min(i+1,l-i+1)):
if s[i-j]!=s[i+j-1] and j==1:
break
elif s[i-j]!=s[i+j-1] and j>1:
ld.append(s[i-j+1:i+j-1])
break
print(len(ld))
for i in ld:
print(i)
s='ssfuhgshjdsdjhvsp-w qncbaccabbvjjkknkl;pp'
findh(s)