Reverse rows

Given an grid of integers, you are asked to reverse each row of that grid and print both the initial and the final grid.
The first line of the input contains two integers - the height of the grid h and the width of the grid w. The next h lines contain w integers.
The program should print 2 grids each with h rows, which have w integers. The first grid should be the initial one, while the second grid should have the rows reversed.
Input
Output
3 4 10 20 30 40 11 21 31 41 12 22 32 42
10 20 30 40 11 21 31 41 12 22 32 42 40 30 20 10 41 31 21 11 42 32 22 12
Tip
Use nested list comprehension to reverse the rows.
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue