Convert Sentence Problem Statement
Convert a given string 'S' into its equivalent representation based on a mobile numeric keypad sequence. Using the keypad layout shown in the reference, output the sequence of numbers that corresponds to typing 'S' on the keypad.
Input:
The first line contains an integer T, indicating the number of test cases.
The first line of each test case has an integer N, representing the length of the string 'S'.
The second line of each test case contains the string 'S'.
Output:
For each test case, output a single line with the numeric keypad sequence needed to type 'S'. Each test case's result is printed on a new line.
Example:
Input:
T = 1
N = 3
S = "abc"
Output:
"222"
Explanation:
If 'abc' is typed on the keypad, the output numeric sequence is '222'.
Constraints:
1 <= T <= 5
1 <= N <= 3000
Note:
No special characters, capital letters, or spaces will be present in the input string.
You do not need to implement I/O operations, just complete the given function.

AnswerBot
4mo
The task is to convert a given string into its equivalent representation based on a mobile numeric keypad sequence.
Iterate through each character in the input string and find its corresponding numeric...read more
Help your peers!
Add answer anonymously...
UST Software Engineer interview questions & answers
A Software Engineer was asked 8mo agoQ. What is Criteria in Hibernate?
A Software Engineer was asked 8mo agoQ. How do you create a custom serializable interface?
A Software Engineer was asked Q. What is the event loop in JavaScript?
Popular interview questions of Software Engineer
A Software Engineer was asked 8mo agoQ1. What is Criteria in Hibernate?
A Software Engineer was asked 8mo agoQ2. How do you create a custom serializable interface?
A Software Engineer was asked Q3. Write a program to check if a string is a palindrome.
Top HR questions asked in UST Software Engineer
A Software Engineer was asked 6mo agoQ1. Can you explain your projects to me?
A Software Engineer was asked Q2. Tell me a little about yourself.
A Software Engineer was asked Q3. What do you like about your current role in the project?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

