Given a String and an Array as input, your task is to output the text the input String will print when typed on a typical Mobile Keypad. In a Mobile Keypad, a letter is typed by pressing a button n times, where n is the position of where the letter is at on the button's label. So, 22
should output b
.
Rules
The Helper Array will contain the Character Map (
[" ",".,!","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]
). This will be given to save you some bytes.The
#
symbol will toggle case. Initial Case will be lower. So2#3
should outputaD
.The
0
will add a space. So,202
should outputa a
.There will be a space (
) in the input String to start a new letter that is on the same numeric button. For Example to type
aa
, the input String will be2 2
.It is guranteed that the input String will always be a valid KeyPad Code.
Input
You can take input in whatever way your language supports.
Output
You can output the result in any way you want. Function return
is also allowed.
Test Cases
#4440555#666888330#999#66688111 -> "I Love You!"
#6#33777 7779990#222#4477744477778627777111 -> "Merry Christmas!"
#44#27 79990#66#3390#999#332777111 -> "Happy New Year!"
This is code-golf, so the shortest code in bytes wins!
year
in the last test case is wrong. \$\endgroup\$##
or double space need to be handled? \$\endgroup\$