Novicesyntax & basics
The Keystone of the Low Arch
The mason rebuilding the low arch by the mill needs one stone finished before the scaffold comes down: the keystone, which by custom carries the middle of the inscription the arch already bears.
You are given runes, a string. Return a string containing the middle of runes:
- If the length of
runesis odd, return the single character at the middle position. - If the length of
runesis even, return the two characters closest to the middle — that is, the two central characters, in their original order. - If
runesis empty, return the empty string.
The result is always a string, never a list, and the characters keep the order they had in runes.
examples
- case 1
runes of "arch""rc" — four characters, so the two central ones - case 2
runes of "stone""o" — five characters, so the single middle one - case 3
runes of """" — nothing to carve
- reward
- 140 XP
- signature
keystoneRunes
TypeScript, run as ES2022 — types are stripped, not checked. If a JS engine would run it, so will we.
loading the editor…
- odd length picks one character
- even length picks two characters
- longer odd inscription
- longer even inscription
- single character
- two characters
- empty inscription
- spaces count as characters