All problems

Flattening a Grid of Ratings

easyPythonNumPyreshape

Fenwick Retail records a star rating for every shop for every week of a campaign: one row per shop, one column per week. The histogram tool the analysts use cannot read a grid. It wants one long run of numbers and simply counts how often each rating appears, so which shop or which week a rating came from does not matter to it. The order still has to be predictable, and the house convention is to read the grid the way you read a page — the whole top row from left to right, then the next row down, and so on to the bottom.

Task: Print every rating in the grid as one flat run.

Input

The first line holds two integers separated by a space: the number of rows and the number of columns. Each of the next rows lines holds cols ratings separated by single spaces.

Output

One line holding all rows * cols ratings separated by single spaces, in the reading order described above, each a plain integer.

Example:

Input:
2 3
1 2 3
4 5 6

Output:
1 2 3 4 5 6

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…