human
Length of the longest substring with consecutive characters | Function to return the ending index for the largest valid sub - str1ing starting from index i.
If the current character appears after the previous character according to the given circular alphabetical order.
Function to return the length of the longest sub - str1ing of consecutive characters from str1.
Valid sub - str1ing exists from index i to end.
Update the Length.
Driver code"
Solution in Python:
 Write me a code to length of the longest substring with consecutive characters and the other steps required?
assistant
#Here is code to length of the longest substring with consecutive characters and the other steps required.
 def getEndingIndex ( str1 , n , i ) :
	i += 1
	while ( i < n ) :
		curr = str1 [ i ]
		prev = str1 [ i - 1 ]
		if ( ( curr == ' a ' and prev == ' z ' ) or ( ord ( curr ) - ord ( prev ) == 1 ) ) :
			i += 1
		else :
			break
	return i - 1
def largestSubstr1 ( str1 , n ) :
	Len = 0
	i = 0
	while ( i < n ) :
		end = getEndingIndex ( str1 , n , i )
		Len = max ( end - i + 1 , Len )
		i = end + 1
	return Len
str1 = " abcabcdefabc "
n = len ( str1 )
print ( largestSubstr1 ( str1 , n ) )