-->
当前位置:首页 > 题库

PROGRAMMING:Determine palindrome string

Luz5年前 (2021-05-10)题库379
Palindrome is string centrosymmetry, reading from left to right and reading from right to left are the same.
Enter a string to determine whether the string is palindrome or not. Only numeric and alphabetic characters are considered, and there is no difference in the case of letters.
###Input format:
Enter a string.
###Output format:
If it is palindrome, output 'yes' on one line, otherwise output' no '.
###Input example:
Here is a set of inputs. For example:
```in
A man,a plan; cnalPanama
```
###Output example:
The corresponding output is given here. For example:
```out
yes
```







answer:If there is no answer, please comment
```
s=input()
lst1=[t.lower() for t in s if t.isdigit() or t.isalpha()]
s1="".join(lst1)
if s1==s1[::-1]:
print("yes")
else:
print("no")
```