human
Minimize the length of string by removing occurrence of only one character | Function to find the minimum length.
Count the frequency of each alphabet.
Find the alphabets with maximum frequency.
Subtract the frequency of character from length of string.
Driver Code"
How can the above be solved in Python?
 Can you provide a code to minimize the length of string by removing occurrence of only one character and the other steps required?
assistant
#Here is code to minimize the length of string by removing occurrence of only one character and the other steps required.
 def minimumLength ( s ) :
	maxOcc = 0
	n = len ( s )
	arr = [ 0 ] * 26
	for i in range ( n ) :
		arr [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1
	for i in range ( 26 ) :
		if arr [ i ] > maxOcc :
			maxOcc = arr [ i ]
	return n - maxOcc
if __name__ == " _ _ main _ _ " :
	str = " afddewqd "
	print ( minimumLength ( str ) )