human
What is a code to check if a Palindromic String can be formed by concatenating Substrings of two given Strings and the other steps required given the following:
Check if a Palindromic String can be formed by concatenating Substrings of two given Strings | Function to check if a palindromic string can be formed from the substring of given strings.
Boolean array to mark presence of characters.
Check if any of the character of str2 is already marked.
If a common character is found.
If no common character is found.
Driver code"
Solution in Python:
assistant
#Here is code to check if a Palindromic String can be formed by concatenating Substrings of two given Strings and the other steps required.
 def check ( str1 , str2 ) :
	mark = [ False for i in range ( 26 ) ]
	n = len ( str1 )
	m = len ( str2 )
	for i in range ( n ) :
		mark [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] = True
	for i in range ( m ) :
		if ( mark [ ord ( str2 [ i ] ) - ord ( ' a ' ) ] ) :
			return True ;
	return False
if __name__ == " _ _ main _ _ " :
	str1 = " abca "
	str2 = " efad "
	if ( check ( str1 , str2 ) ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;