|
@@ -12,11 +12,15 @@ regarded as forming a rectangle when printed with intervening newlines.
|
12
|
12
|
|
13
|
13
|
For example, the sentence
|
14
|
14
|
|
15
|
|
-> If man was meant to stay on the ground, god would have given us roots.
|
|
15
|
+```text
|
|
16
|
+"If man was meant to stay on the ground, god would have given us roots."
|
|
17
|
+```
|
16
|
18
|
|
17
|
19
|
is normalized to:
|
18
|
20
|
|
19
|
|
-> ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots
|
|
21
|
+```text
|
|
22
|
+"ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots"
|
|
23
|
+```
|
20
|
24
|
|
21
|
25
|
The plaintext should be organized in to a rectangle. The size of the
|
22
|
26
|
rectangle (`r x c`) should be decided by the length of the message,
|
|
@@ -27,13 +31,13 @@ Our normalized text is 54 characters long, dictating a rectangle with
|
27
|
31
|
`c = 8` and `r = 7`:
|
28
|
32
|
|
29
|
33
|
```text
|
30
|
|
-ifmanwas
|
31
|
|
-meanttos
|
32
|
|
-tayonthe
|
33
|
|
-groundgo
|
34
|
|
-dwouldha
|
35
|
|
-vegivenu
|
36
|
|
-sroots
|
|
34
|
+"ifmanwas"
|
|
35
|
+"meanttos"
|
|
36
|
+"tayonthe"
|
|
37
|
+"groundgo"
|
|
38
|
+"dwouldha"
|
|
39
|
+"vegivenu"
|
|
40
|
+"sroots "
|
37
|
41
|
```
|
38
|
42
|
|
39
|
43
|
The coded message is obtained by reading down the columns going left to
|
|
@@ -42,7 +46,7 @@ right.
|
42
|
46
|
The message above is coded as:
|
43
|
47
|
|
44
|
48
|
```text
|
45
|
|
-imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
|
49
|
+"imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau"
|
46
|
50
|
```
|
47
|
51
|
|
48
|
52
|
Output the encoded text in chunks that fill perfect rectangles `(r X c)`,
|
|
@@ -51,21 +55,21 @@ with `c` chunks of `r` length, separated by spaces. For phrases that are
|
51
|
55
|
chunks with a single trailing space.
|
52
|
56
|
|
53
|
57
|
```text
|
54
|
|
-imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
|
|
58
|
+"imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau "
|
55
|
59
|
```
|
56
|
60
|
|
57
|
61
|
Notice that were we to stack these, we could visually decode the
|
58
|
62
|
cyphertext back in to the original message:
|
59
|
63
|
|
60
|
64
|
```text
|
61
|
|
-imtgdvs
|
62
|
|
-fearwer
|
63
|
|
-mayoogo
|
64
|
|
-anouuio
|
65
|
|
-ntnnlvt
|
66
|
|
-wttddes
|
67
|
|
-aohghn
|
68
|
|
-sseoau
|
|
65
|
+"imtgdvs"
|
|
66
|
+"fearwer"
|
|
67
|
+"mayoogo"
|
|
68
|
+"anouuio"
|
|
69
|
+"ntnnlvt"
|
|
70
|
+"wttddes"
|
|
71
|
+"aohghn "
|
|
72
|
+"sseoau "
|
69
|
73
|
```
|
70
|
74
|
|
71
|
75
|
# Running the tests
|