A new poetry club has opened in town, and you're thinking of attending. Because there have been incidents in the past, the club has a very specific door policy which you'll need to master, before attempting entry.
There are two doors at the poetry club, both are guarded. In order to gain entry, you'll need to work out the password of that day:
- The guard will recite a poem, one line at the time;
- You will have to respond with the appropriate letter.
- The guard will tell you all the letters you've responded with at once;
- You need to format the letters as a capitalised word.
For example, one of their favourite writers is Michael Lockwood, who's written the following acrostic poem, which means that the first letter of each sentence form a word:
Stands so high
Huge hooves too
Impatiently waits for
Reins and harness
Eager to leave
When the guard recites Stands so high, you'll respond S, when the guard recites Huge hooves too, you'll respond H.
Finally the password you write down is Shire
, and you'll get in.
In the back of the club you'll find the most renowned poets, which is like the VIP area. Because this is not for everyone, the back door process is a bit more convoluted.
- The guard will recite a poem, one line at the time;
- You will have to respond with the appropriate letter.
- The guard will tell you all the letters you've responded with at once, but
there are sometimes spaces after each sentence:
- You need to format the letters as a capitalised word
- and ask nicely, by appending
, please
For example, the poem mentioned before is also telestich, which means that the last letter of each sentence form a word:
Stands so high
Huge hooves too
Impatiently waits for
Reins and harness
Eager to leave
When the guard recites Stands so high, you'll respond h, when the guard recites Huge hooves too, you'll respond o.
Finally the password you write down is Horse, please
, and you can party
with the renowned poets.
- JavaScript: strings (reference implementation)
- Swift: string-components