使用python非常简单,只要字符串反过来跟正着的相等即可:

class Solution:
    def judge(self , str ):
        # write code here
        if str == str[::-1]:
            return True 
        else:
            return False