Remembering numbers can be difficult. Remembering a word may be easier. In order to memorize big numbers, I created a way to pronounce them in a leetspeak-like way.
Each digit is first replaced by its corresponding letter:
0 => O 1 => I 2 => R 3 => E 4 => A 5 => S 6 => G 7 => T 8 => B 9 => P
After the replacement, two additional things are done to improved pronunciation:
Between two consonants, a
Between two vowels, a
512431 => SIRANENI 834677081 => BENAGUTUTOBI 3141592 => ENINANISUPUR 1234567890 => IRENASUGUTUBUPO 6164817 => GIGABIT
- Letters and numbers mixed in the same word
- Two successive consonants or two successive vowels
- Letters that are not in the list above
- Other characters
The goal of this code-golf is to create a 2-way translator for this concept.
- Your program must first understand by itself if it's letter-to-number or number-to-letter translation.
- It must check for the entry to be properly formed.
- If everything is correct, display the translation.
- Else, display an error message, nothing, return a falsey value or crash the program.
- The input number/string can be entered in whatever format you want (stdin, argument, ...)
- This is code-golf, so shortest answer wins.
- Standard loopholes are forbidden.