You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/concept/poetry-club/.docs/instructions.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ splitOnNewlines("Hello.\nHow are you?\n\nI'm doing fine.")
24
24
1. The guard will recite a poem
25
25
2. You will have to split the poem into individual lines.
26
26
3. You will have to get the first letter of each line.
27
+
- If the line is empty, you should use `_` instead.
27
28
4. You will have to ensable the letters, which will form a word.
28
29
29
30
For example, one of their favorite writers is Michael Lockwood, who's written the following _acrostic_ poem, which means that the first letter of each sentence form a word:
@@ -58,7 +59,7 @@ Because this is not for everyone, the back door process is a bit more convoluted
58
59
2. You will have to split the poem into lines.
59
60
3. You will have to get the last letter of each line.
60
61
- The line will sometimes have trailing spaces, so you will need to strip them off.
61
-
4. You will have to assemble the letters and then add `", please."` to the end of the word formed by the letters.
62
+
4. You will have to assemble the letters and then add `", please"` to the end of the word formed by the letters.
62
63
63
64
For example, the poem mentioned before is also _telestich_, which means that the last letter of each sentence form a word:
64
65
@@ -72,15 +73,15 @@ Eager to leave
72
73
73
74
When the guard recites the poem, you will split it into individual lines, strip off any trailing spaces, and respond with the first letters of each line, i.e. `["h", "o", "r", "s", "e"]`.
74
75
75
-
The guard will then give you the word formed by the array of letters you replied with for you to put into capitalized word form and append `", please."`.
76
-
Finally the password you return is `"horse, please."`, and you'll get in.
76
+
The guard will then give you the word formed by the array of letters you replied with for you to put into capitalized word form and append `", please"`.
77
+
Finally the password you return is `"horse, please"`, and you'll get in.
77
78
78
79
Implement the function `backDoorPassword` that takes a string which represents the poem.
79
80
The function should return the password that you would give to the guard.
80
81
81
82
```swift
82
83
backDoorPassword("Stands so high\nHuge hooves too\nImpatiently waits for\nReins and harness\nEager to leave")
0 commit comments