Find the minimum cost
if ( ( s1 [ i ] == ' ' && s2 [ i ] == ' ' ) || ( s2 [ i ] == ' ' && s1 [ i ] == ' ' ) ) cost += Math . min ( d , Math . min ( a , b + c ) ) ; else if ( ( s1 [ i ] == ' ' && s2 [ i ] == ' ' ) || ( s2 [ i ] == ' ' && s1 [ i ] == ' ' ) ) cost += Math . min ( d , Math . min ( b , a + c ) ) ; else if ( ( s1 [ i ] == ' ' && s2 [ i ] == ' ' ) || ( s2 [ i ] == ' ' && s1 [ i ] == ' ' ) ) cost += Math . min ( d , Math . min ( c , a + b ) ) ; } } return cost ; }