#C11023. Push Boxes to the Left
Push Boxes to the Left
Push Boxes to the Left
You are given a grid with \(n\) rows and \(m\) columns, where each cell is either empty (represented by '.') or contains a box (represented by 'x'). Your task is to transform the grid by pushing all the boxes in each row to the left. This means that in each row, all the 'x' characters should appear first (in the order they appear, but just concatenated together) followed by the '.' characters filling the remaining positions.
Example:
Input: 3 5 ..x.x x..x. .x.x.</p>Output: xx... xx... xx...
Note: In every row, if there are \(k\) boxes, the output should be a string with the first \(k\) characters as 'x' and the remaining \(m-k\) characters as '.'.
inputFormat
The input begins with a line containing two integers \(n\) and \(m\) (the number of rows and columns respectively). The following \(n\) lines each contain a string of length \(m\), representing a row of the grid.
Input Format:
n m row_1 row_2 ... row_n
outputFormat
Output \(n\) lines. Each line should represent the transformed row after moving all the boxes to the left.
## sample3 5
..x.x
x..x.
.x.x.
xx...
xx...
xx...
</p>