* and don't have a word processor with top-left align support :D
Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be taken as a space-padded matrix of characters. Squash it upwards, then squash it left. Output this, with any amount of trailing newlines and spaces.
To squash upwards
For any non-space character "below" a space, swap their places, until there are no more non-space characters below spaces.
To squash left
For each line, remove all spaces.
With the input (STDIN, function arguments, etc.):
a b c d e ff ggg h i jj kk lll
afbgcgdhle fjj gk l i k l
afbgcgdhle fjjgkli kl
Output this text. (STDOUT, function return value, etc.)
input => output ------- a b c => abc ------- a c => a c ------- => ------- ^ note that trailing spaces are allowed so a single line with a space is valid here a => a ------- a => a ------- ab c => ab c ------- abc d e f g => abc de fg ------- abc d f g => abc dg f
This is code-golf, shortest answer in bytes per language wins.
Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.