Skip to main content
posted
Source Link
Wezl
  • 1.5k
  • 6
  • 13

I'm Lazy*: Top-left align my textI'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input, with at least four unique characters 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.posted


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input, with at least four unique characters 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

https://chat.stackexchange.com/transcript/message/58207117#58207117
Source Link
Wezl
  • 1.5k
  • 6
  • 13

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input, with at least four unique characters 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input. 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input, with at least four unique characters 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

Too trivial? also, upvote bait ;)
Source Link
Wezl
  • 1.5k
  • 6
  • 13

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input. 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input. 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

I'm Lazy*: Top-left align my text

* and don't have a word processor

Take several lines of input. 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.

Example:

With the input:

a b c d  e
ff ggg h i
 jj kk lll

Squash upwards:

afbgcgdhle
fjj gk l i
    k    l

Squash left:

afbgcgdhle
fjjgkli
kl

Output this text.


Finding out which academic journal requires submissions to be top-left aligned is left as an excercise for the reader.


Duplicate? Even a challenge with only "squash up" would probably be a duplicate

Too trivial?

Source Link
Wezl
  • 1.5k
  • 6
  • 13
Loading