#NEWLINE# def generatePalindromes( self , s ) : #NEWLINE# #INDENT# '\n        :type s: str\n        :rtype: List[str]\n        ' #NEWLINE# cnt = collections . Counter ( s ) #NEWLINE# mid = tuple ( ( k for ( k , v ) in cnt . iteritems ( ) if ( v % 2 ) ) ) #NEWLINE# chars = '' . join ( ( ( k * ( v / 2 ) ) for ( k , v ) in cnt . iteritems ( ) ) ) #NEWLINE# return ( [ '' . join ( ( ( half_palindrome + mid ) + half_palindrome [ : : ( - 1 ) ] ) ) for half_palindrome in set ( itertools . permutations ( chars ) ) ] if ( len ( mid ) < 2 ) else [ ] )