输入一个随机字符串,将其重新排列后,正向看与反向看一致,示例:abcba -> abcba
解题思路:将s其去重得到lt,遍历一遍lt,查看lt每个元素在s中出现的次数,出现奇数的次数为0或1次则s是回文串
s = input('请输入字符串:')
num = 0
lt = []
for i in s:
if i not in lt:
lt.append(i)
for j in lt:
x = s.count('%s'%j)
if x % 2 != 0:
num += 1
print(num == 0 or num == 1)