human
Check if left and right shift of any string results into given string | Function to check string exist or not as per above approach.
Check if any character at position i and i + 2 are not equal , then string doesnot exist.
Driver Code"
Solution in Python:

=====
Give me a code to check if left and right shift of any string results into given string and the other steps required?
assistant
#Here is code to check if left and right shift of any string results into given string and the other steps required.
 def check_string_exist ( S ) :
	size = len ( S )
	check = True
	for i in range ( size ) :
		if S [ i ] != S [ ( i + 2 ) % size ] :
			check = False
			break
	if check :
		print ( " Yes " )
	else :
		print ( " No " )
S = " papa "
check_string_exist ( S )