Bi-directional translator
The challenge is to create a translator that can translate a [a-zA-Z ]
string into another string according to the mappings below. The translator should also be able to translate translated text back into its normal form (hence bi-directional). Case doesn't have to be maintained and can be either lower/uppercase (or both lower and upper-cased) in the output, however your program should be able to handle either lower/uppercase strings.
Here is the specification of the mappings for this challenge:
-------------------
|Letter | Mapping |
-------------------
| S | 9 |
| F | 1 |
| H | 5 |
| X | = |
| Z | {N} |
| M | --* |
| N | :) |
| G | ] |
| T | [ |
-------------------
Here are some example in/outputs: (The " or ... or ..." obviously shouldn't be in your actual output, its just to demonstrate the possible outputs)
> ABS
< AB9 or ab9 or Ab9 or aB9
> foo
< 1oo or 1OO or ...
> FIZZ BUZZ
> 1i{N}{N} bu{N}{N} or 1I{N}{N} BU{N}{N} or ...
> {n}[:)
< ztn or ZTN or ...
> bar
< bar or BAR or ...
The inputs will always be in [a-zA-Z ]
or a "translated" string containing the mapped symbol, other symbols or characters outside wouldn't be inputted.