human
Check if strings are rotations of each other or not | Set 2 | Python program to check if two strings are rotations of each other.
create lps [ ] that will hold the longest prefix suffix values for pattern.
length of the previous longest prefix suffix.
lps [ 0 ] is always 0.
the loop calculates lps [ i ] for i = 1 to n - 1.
Match from that rotating point.
Driver code"
Solution in Python:

What is a code to check if strings are rotations of each other or not and the other steps required?
assistant
#Here is code to check if strings are rotations of each other or not and the other steps required.
 def isRotation ( a : str , b : str ) -> bool :
	n = len ( a )
	m = len ( b )
	if ( n != m ) :
		return False
	lps = [ 0 for _ in range ( n ) ]
	length = 0
	i = 1
	lps [ 0 ] = 0
	while ( i < n ) :
		if ( a [ i ] == b [ length ] ) :
			length += 1
			lps [ i ] = length
			i += 1
		else :
			if ( length == 0 ) :
				lps [ i ] = 0
				i += 1
			else :
				length = lps [ length - 1 ]
	i = 0
	for k in range ( lps [ n - 1 ] , m ) :
		if ( b [ k ] != a [ i ] ) :
			return False
		i += 1
	return True
if __name__ == " _ _ main _ _ " :
	s1 = " ABACD "
	s2 = " CDABA "
	print ( "1" if isRotation ( s1 , s2 ) else "0" )