human
Check if a string is concatenation of another given string | Function to check if a is concatenation of another string.
Stores the length of str2.
Stores the length of str1.
If M is not multiple of N.
Traverse both the strings.
If str1 is not concatenation of str2.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if a string is concatenation of another given string and the other steps required.
 def checkConcat ( str1 , str2 ) :
	N = len ( str1 )
	M = len ( str2 )
	if ( N % M != 0 ) :
		return False
	for i in range ( N ) :
		if ( str1 [ i ] != str2 [ i % M ] ) :
			return False
	return True
if __name__ == ' _ _ main _ _ ' :
	str1 = " abcabcabc "
	str2 = " abc "
	if ( checkConcat ( str1 , str2 ) ) :
		print ( " Yes " )
	else :
		print ( " No " )