Inspired by the Codewars Kata.
Your goal is to take an input string such as this one:
"'Twas a dark and stormy night..."
and return a string containing the position of each character in the alphabet, separated by spaces and ignoring non-alphabetical characters, like this:
"20 23 1 19 1 4 1 18 11 1 14 4 19 20 15 18 13 25 14 9 7 8 20"
For an additional challenge, you can replace any numerical characters in the original string with themselves + 27. For example, "25"
would become "29, 32"
. This is completely optional.
You must use 1-indexing ('a'==1
, 'b'==2
, etc)
Additional rules:
You must return a string, not an array.
Trailing whitespace is OK.
The winner has the lowest byte count.
Good luck!