T9, you need to press number key representing that character n times.n is order of that character written on that key. Numbers are the last character you can type for each key.For example, to type B I press 2 two times, or to type 5 I press 5 four times. To finish typing this character I press #. * is simply backspace. In our version of keyboard there is no capitalization.
Input / Output A function that accepts string of input characters and returns result string. If your programming language doesn't support functions or for any other reason you get input from stdin as a sequence of characters. Note that it can include * for backspace and print output to stdout.
Smallest function wins.