Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Orbroid dialer
- Problem Statement:
- Orbroid is an emerging mobile platform, which is opensource and available for various hardware configurations. Given your inclination towards opensource, you decide to contribute code for this platform and choose the module with following functional specification:
- Dialer is the central app of orbroid platform which searches for name/number from the contact book when you start dialing numbers on the T9 keypad. The entries in contact book are internally stored as <firstname>:[lastname]:<number>
- where ":" is the field seperator.
- The search should consider the T9 text equivalent of entered number. An entry matches if the entered number matches any of firstname, lastname or number field. T9 keypad is shown as follows:
- ----------------
- - 1 - 2 - 3 -
- -... -abc -def -
- ----------------
- - 4 - 5 - 6 -
- -ghi -jkl -mno -
- ----------------
- - 7 - 8 - 9 -
- -pqrs-tuv -wxyz-
- ----------------
- ------ 0 ------
- ------|_| ------
- ----------------
- PS: Any special character apart from space maps to key 1. Space maps to key 0.
- Constraints:
- firstname can be [a-zA-Z_-,. ();]+ and 100 characters in length
- lastname can be [a-zA-Z_-,. ();]* and 100 characters in length
- number can be [0-9]+ and 20 characters in length
- Input:
- First line contains N, 0<n<10^5, followed by N lines, with each line having format of
- First Name:Optional Lastname:Number
- Last line containing the string (of numbers) to be searched
- Output:
- List of matches in contacts, arranged in increasing order of matching
- position, in format of
- First Name:Optional Lastname:Number
- In case multiple matches have same matching position then according to the order in which they appear in the input.
- In case no matches are found, then the string, “NOT FOUND” has to be printed without quotes.
- Example:
- Input:
- 4
- Steve:Kilogo:837291091
- Mark:Lostworth:428204772
- Bill:Laker:256469278
- John:Mc millan:7778883929
- 5646
- Output:
- John:Mc millan:7778883929
- Bill:Laker:256469278
- Steve:Kilogo:837291091
- Input:
- 3
- Gill:Shaw:61276374888
- Mary:Tudor:2818891889
- Rajiv:Ghosh:919928388011
- 8960
- Output:
- NOT FOUND
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement