Given a string that contains only lowercase letters, encode that string with the alphabet cipher.
To encode with the alphabet cipher (I will be using the example hello
):
- First, convert each letter in the string to a number depending on its position in the alphabet (
a
=1
,b
=2
, etc.) Example:8
5
12
12
15
- Pad each number to two characters with
0
s. Example:08
05
12
12
15
- Join. Example:
0805121215
Test cases
helloworld -> 08051212152315181204
codegolf -> 0315040507151206
alphabetcipher -> 0112160801020520030916080518
johncena -> 1015081403051401
Remember, this is code-golf, so the code with the fewest number of bytes wins.