题目描述
Given a sentence in the form of a string in uppercase, convert it into its equivalent mobile numeric keypad sequence. Please note there might be spaces in between the words in a sentence and we can print spaces by pressing 0.
Example 1:
Input:
S = "GFG"
Output: 43334
Explanation: For 'G' press '4' one time.
For 'F' press '3' three times.
Example 2:
Input:
S = "HEY U"
Output: 4433999088
Explanation: For 'H' press '4' two times.
For 'E' press '3' two times. For 'Y' press '9'
three times. For white space press '0' one time.
For 'U' press '8' two times.
Your Task:
You dont need to read input or print anything. Complete the function printSequence() which takes a string as input parameter and returns its equivalent mobile numeric keypad sequence as a string.
Expected Time Complexity: O(Length of String)
Expected Auxiliary Space: O(Length of String)
Constraints:
1 <= Length of String <= 10^{5}
Characters of string can be empty space or capital alphabets.
输入格式
见题面
输出格式
见题面