human
What is a code to find the size of largest subset of anagram words and the other steps required given the following:
Find the size of largest subset of anagram words | Utility function to find size of largest subset of anagram.
sort the string.
Increment the count of string.
Compute the maximum size of string.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the size of largest subset of anagram words and the other steps required.
 def largestAnagramSet ( arr , n ) :
	maxSize = 0
	count = { }
	for i in range ( n ) :
		arr [ i ] = ' ' . join ( sorted ( arr [ i ] ) )
		if arr [ i ] in count :
			count [ arr [ i ] ] += 1
		else :
			count [ arr [ i ] ] = 1
		maxSize = max ( maxSize , count [ arr [ i ] ] )
	return maxSize
arr = [ " ant " , " magenta " , " magnate " , " tan " , " gnamate " ]
n = len ( arr )
print ( largestAnagramSet ( arr , n ) )
arr1 = [ " cars " , " bikes " , " arcs " , " steer " ]
n = len ( arr1 )
print ( largestAnagramSet ( arr1 , n ) )