human
Minimum cost to make two strings same | Function to return the minimum cost to make the configuration of both the strings same.
Iterate and find the cost.
Find the minimum cost.
Driver Code"
Solution in Python:
assistant
#Here is code to minimum cost to make two strings same and the other steps required.
 def findCost ( s1 , s2 , a , b , c , d , n ) :
	cost = 0
	for i in range ( n ) :
		if ( s1 [ i ] == s2 [ i ] ) :
			continue
		else :
			if ( ( s1 [ i ] == '1' and s2 [ i ] == '2' ) or ( s2 [ i ] == '1' and s1 [ i ] == '2' ) ) :
				cost += min ( d , min ( a , b + c ) )
			elif ( ( s1 [ i ] == '2' and s2 [ i ] == '3' ) or ( s2 [ i ] == '2' and s1 [ i ] == '3' ) ) :
				cost += min ( d , min ( b , a + c ) )
			elif ( ( s1 [ i ] == '1' and s2 [ i ] == '3' ) or ( s2 [ i ] == '1' and s1 [ i ] == '3' ) ) :
				cost += min ( d , min ( c , a + b ) )
	return cost
if __name__ == ' _ _ main _ _ ' :
	s1 = "121"
	s2 = "223"
	a = 2
	b = 3
	c = 4
	d = 10
	n = len ( s1 )
	print ( findCost ( s1 , s2 , a , b , c , d , n ) )