number of substring which are whose anagrams are palindrome
问题 Given a string of digits, count the number of subwords (consistent subsequences) that are anagrams of any palindrome. My attempt in Python: def ispalin(s): if len(s)%2==0: for i in s: if s.count(i)%2!=0: return False else: sum =0 for i in set(s): if s.count(i)%2==1: sum = sum+1 if sum == 1: return True else: return False return True def solution(S): # write your code in Python 3.6 count=len(S) for i in range(len(S)): for j in range(i+1,len(S)): if ispalin(S[i:j+1]): count=count+1 return count