Number of character corrections in the given strings to make them equal | Function to return the count of operations required ; To store the count of operations ; No operation required ; One operation is required when any two characters are equal ; Two operations are required when none of the characters are equal ; Return the minimum count of operations required ; Driver code
< ? php function minOperations ( $ n , $ a , $ b , $ c ) { $ ans = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ x = $ a [ $ i ] ; $ y = $ b [ $ i ] ; $ z = $ c [ $ i ] ; if ( $ x == $ y && $ y == $ z ) ; else if ( $ x == $ y $ y == $ z $ x == $ z ) { $ ans ++ ; } else { $ ans += 2 ; } } return $ ans ; } $ a = " place " ; $ b = " abcde " ; $ c = " plybe " ; $ n = strlen ( $ a ) ; echo minOperations ( $ n , $ a , $ b , $ c ) ; ? >