human
Check if a string can be made equal to another string by swapping or replacement of characters | Function to find if given strings are same or not.
Base Condition.
Stores frequency of characters of the str1 and str2.
Traverse strings str1 & str2 and store frequencies in a [ ] and b [ ].
Check if both strings have same characters or not.
If a character is present in one and is not in another string , return false.
Sort the array a [ ] and b [ ].
Check arrays a and b contain the same frequency or not.
If the frequencies are not the same after sorting.
At this point , str1 can be converted to str2.
Driver Code"
Solution in Python:

What is a code to check if a string can be made equal to another string by swapping or replacement of characters and the other steps required?
assistant
#Here is code to check if a string can be made equal to another string by swapping or replacement of characters and the other steps required.
 def sameStrings ( str1 , str2 ) :
	N = len ( str1 )
	M = len ( str2 )
	if ( N != M ) :
		return False
	a , b = [ 0 ] * 256 , [ 0 ] * 256
	for i in range ( N ) :
		a [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] += 1
		b [ ord ( str2 [ i ] ) - ord ( ' a ' ) ] += 1
	i = 0
	while ( i < 256 ) :
		if ( ( a [ i ] == 0 and b [ i ] == 0 ) or ( a [ i ] != 0 and b [ i ] != 0 ) ) :
			i += 1
		else :
			return False
	a = sorted ( a )
	b = sorted ( b )
	for i in range ( 256 ) :
		if ( a [ i ] != b [ i ] ) :
			return False
	return True
if __name__ == ' _ _ main _ _ ' :
	S1 , S2 = " cabbba " , " abbccc "
	if ( sameStrings ( S1 , S2 ) ) :
		print ( " YES " )
	else :
		print ( " NO " )