Analyzing string head and tail structure

A string input, determines whether or not the corresponding head and tail. Such as string 'abcba' is corresponding to the head and tail. Such as string '+ - ** - +', also corresponding to the head and tail. Such as string 'abcbb' it is not corresponding to the head and tail.

Input formats:

Enter a string

Output formats:

If the corresponding head and tail, the output of 'yes' output or 'no'

Sample input:

abcba
 

Sample output:

yes
s1=input()

if s1==s1[::-1]:
    print('yes')
else:
    print('no')

  

Guess you like

Origin www.cnblogs.com/SkystarX/p/12334065.html