human
Longest substring with no pair of adjacent characters are adjacent English alphabets | Function to find the longest substring satisfying the given condition.
Stores all temporary substrings.
Stores the longest substring.
Stores the length of the subT.
Stores the first character of S.
Traverse the string.
If the absolute difference is 1.
Update the length of subT.
Update the longest substring.
Otherwise , stores the current character.
Again checking for longest substring and update accordingly.
Print the longest substring.
Driver Code.
Given string.
Function call to find the longest substring satisfying given condition"
How can the above be solved in Python?
 ... Can you provide a code to longest substring with no pair of adjacent characters are adjacent English alphabets and the other steps required?
assistant
#Here is code to longest substring with no pair of adjacent characters are adjacent English alphabets and the other steps required.
 def findSubstring ( S ) :
	T = " "
	ans = " "
	l = 0
	T += S [ 0 ]
	for i in range ( 1 , len ( S ) ) :
		if ( abs ( ord ( S [ i ] ) - ord ( S [ i - 1 ] ) ) == 1 ) :
			l = len ( T )
			if ( l > len ( ans ) ) :
				ans = T
			T = " "
			T += S [ i ]
		else :
			T += S [ i ]
	l = len ( T )
	if ( l > len ( ans ) ) :
		ans = T
	print ( ans )
if __name__ == ' _ _ main _ _ ' :
	S = " aabdml "
	findSubstring ( S )