Move zero elements to the right
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given a two-dimensional array of size n x m, your task is to shift all zero elements to the right within each row.
Input
The first line contains two integers, n and m, representing the number of rows and columns, respectively.
The following n lines each contain m integers, which are the elements of the array.
Output
Print the modified array.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 61%