给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。输入: "A man, a plan, a canal: Panama" 输出: true def isPalindrome(s): s1='' for i in s: if (ord(i)>=48 and ord(i)<=57) or (ord(i)>=65 and ord(i)<=90) or (ord(i)>=97 and ord(i)<=...
python def first_unique_char(s: str) -> str: # 字典用于存储字符及其出现次数 char_count = {} # 第一步:统计每个字符的出现次数 for char in s: if char in char_count: char_count[char] += 1 else: char_count[char] = 1 # 第二步:找到第一个出现次数为1的字符 for char in s: i...