human
Maximum occurring character in an input string | Set | function to find the maximum occurring character in an input string which is lexicographically first.
freq [ ] used as hash table.
to store maximum frequency.
length of str.
get frequency of each character of 'str.
for each character , where character is obtained by ( i + ' a ' ) check whether it is the maximum character so far and accodingly update 'result.
maximum occurring character.
Driver Code"
Solution in Python:
 ... Write me a code to maximum occurring character in an input string and the other steps required?
assistant
#Here is code to maximum occurring character in an input string and the other steps required.
 def getMaxOccurringChar ( str ) :
	freq = [ 0 for i in range ( 100 ) ]
	max = - 1
	len__ = len ( str )
'
	for i in range ( 0 , len__ , 1 ) :
		freq [ ord ( str [ i ] ) - ord ( ' a ' ) ] += 1
'
	for i in range ( 26 ) :
		if ( max < freq [ i ] ) :
			max = freq [ i ]
			result = chr ( ord ( ' a ' ) + i )
	return result
if __name__ == ' _ _ main _ _ ' :
	str = " sample ▁ program "
	print ( " Maximum ▁ occurring ▁ character ▁ = " , getMaxOccurringChar ( str ) )