Have you ever wondered why they always have alphabet next to the digits on the keys? Historically, have been used, mainl
Posted: Thu Jun 02, 2022 8:19 am
Have you ever wondered why they always have alphabet next to the digits on the keys? Historically, have been used, mainly in the United States, as a technique for remembering telephone numbers easily. For example, an interior decorator might license the telephone number 1-800-724-6837, but advertise it as the more memorable phone word 1-800-PAINTER. Notice how there's an hyphen after every 3 digits. Q) How? A) When you type PAINTER you will actually end up typing on the keys 724-683-7 Write a program, which accepts a code word of the format '1-800-HOLIDAY and converts that into the original phone number. Example 1: Input: 1-800-HOLIDAY Output: 1-800-405-432-9 Example 2: Input: 1-800-BHANUPIZZA Output: 1-800-242-687-499-2 Hint: 1) Ignore the 1-800-part and focus on the alphabetic string part. 2) For every character figure out the digit of the key it belongs to. To achieve this, create an arrays with strings {"ABC", "DEF" .. "WXYZ"} For every character check the index of the string that it is a member of. Constraints: Always assume the strings are uppercase. Always assume the strings are not longer than 20 characters.