Question: Say I have text like this (each word on one line, with no spaces)

```
Programming
Puzzles
&
Code
Golf

```

That makes no sense! It totally defies the laws of physics.

Your challenge is to remedy this impossible situation and collapse the text like so:

```
P
Prog
&uzz
Coderam
Golflesming

```

So that there is no empty space underneath any character but the characters retain their vertical order.

The goal is to satisfy the requirements but use the fewest bytes of source code possible.

Answer: 
CJam, 11 bytes
==============

```
qN/W%zzW%N*

```

Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=qN%2FW%25zzW%25N*&input=Programming%0APuzzles%0A%26%0ACode%0AGolf).

### How it works

The idea in the same as in my [Pyth answer](https://codegolf.stackexchange.com/a/55229).

```
q           e# Read from STDIN.
 N/         e# Split at linefeeds.
   W%       e# Reverse the resulting array.
     zz     e# Transpose it twice.
       W%   e# Reverse the resulting array.
         N* e# Join its strings; separate with linefeeds.

```
Perl, 133 bytes
---------------

This was one of those challenges that changed in my head from being too hard, to being easy, to being a lot more code than I'd anticipated... I'm not particularly happy with the approach, I'm sure there's a much better way to reduce the `print pop@F...` bit perhaps using `-n` or just pure regex, but I can't get there right now... Originally I was using `say`, but I think I'd have to score that higher (`use 5.01`) because of `$'`.

```pl
@F=(/.+/g,@F)for<>;$_%=$#F,($x=length$F[$_++])<length$F[$_]&&($F[$_]=~/.{$x}/,$F[$_-1].=$',$F[$_]=$&)for 0..1e2;print pop@F,$/while@F

```

### Usage

Save as `vertically-collapse-text.pl`.

```sh
perl vertically-collapse-text.pl <<< 'Programming
Puzzles
&
Code
Golf'
P
Prog
&uzz
Coderam
Golflesming

```