Your task is to output a 'depthmap' - that is, a heightmap of an object but not seen from its top but from its front.
For example, consider the following object as shown on the image. The height map is shown on the left. The corresponding depth map would be (as seen from standing at the arrow):
010 211 <- Depthmap 322
If you stand at the arrow, there are 3 cubes behind each other at the bottom left-hand point, 2 behind each other on the middle left-hand point, 0 at the top left-hand point etc.
Input is a two dimensional array of any sizes (not necessarily square).
Output is another two dimensional array which represents the depthmap. As you can deduce, its sizes are
(height x width). In the image, it would be
(3 x 3). Note that if the highest tower of cubes was 5, the depthmap would be an array of
(5 x 3).
The shortest code wins.
All languages allowed, no explicit restrictions. (I don't know what you can come up with, but play fair please.)
Input: Ouput: 5321 0001 1456 1012 2105 1112 1212 2222 3323 Input: Output: 22 01 13 12 00 22 Input: Output: (of the sample image) 232 010 210 211 101 322