human
What is a code to maximum length substring with highest frequency in a string and the other steps required given the following:
Maximum length substring with highest frequency in a string | function to return maximum occurred substring of a string.
size of string.
to store maximum frequency.
To store string which has maximum frequency.
return substring which has maximum freq.
Driver code.
Function call"
Solution in Python:
assistant
#Here is code to maximum length substring with highest frequency in a string and the other steps required.
 def MaxFreq ( s ) :
	n = len ( s )
	m = dict ( )
	for i in range ( n ) :
		string = ' '
		for j in range ( i , n ) :
			string += s [ j ]
			if string in m . keys ( ) :
				m [ string ] += 1
			else :
				m [ string ] = 1
	maxi = 0
	maxi_str = ' '
	for i in m :
		if m [ i ] > maxi :
			maxi = m [ i ]
			maxi_str = i
		elif m [ i ] == maxi :
			ss = i
			if len ( ss ) > len ( maxi_str ) :
				maxi_str = ss
	return maxi_str
string = " ababecdecd "
	print ( MaxFreq ( string ) )