#C9483. Minimum Operations to Transform Tile Grid
Minimum Operations to Transform Tile Grid
Minimum Operations to Transform Tile Grid
You are given a grid of tiles consisting of n rows and m columns. Each tile is colored either white (W) or black (B). Two configurations of the grid are provided: the initial configuration and the target configuration.
In one operation, you can flip a single tile from white to black or black to white. Your task is to calculate the minimum number of operations required to transform the initial configuration into the target configuration.
Input Format: The first line contains two integers, n and m. The next n lines describe the initial configuration of the grid, and the following n lines describe the target configuration.
Output Format: Output a single integer denoting the minimum number of operations required.
Note: The only allowed operation is flipping the color of a single tile.
inputFormat
The input begins with a line containing two space-separated integers n and m, representing the number of rows and columns in the grid.
The next n lines contain a string of length m each, representing the initial configuration of the grid.
The following n lines each contain a string of length m, representing the target configuration of the grid.
outputFormat
Output a single integer: the minimum number of operations required to transform the initial grid configuration into the target grid configuration.
## sample3 3
WBW
BBW
WWW
BBB
BWB
BBW
6