回文正序和逆序一样的字符串,例如abccba 方法一 def is_palindrome1(text): l = list(text) l.reverse() t1 = ''.join(l) if t1 == text: print 'the text is palindrome' else: print 'the text is not palindrome' 方法二 def is_palindrome2(text): t1 = text[::-1] if t1 == text: print…
//判断给定字符串是否是回文 function isPalindrome(word) { var s = new Stack(); for (var i = 0; i < word.length; i++) { s.push(word[i]); } var rword = ""; while (s.length()>0) { rword +…