Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. Orbroid dialer
  2.  
  3.  
  4.  
  5. Problem Statement:
  6. 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:
  7.  
  8.  
  9. 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>
  10.  
  11. where ":" is the field seperator.
  12.  
  13.  
  14. 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:
  15.  
  16.  
  17. ----------------
  18. - 1 - 2 - 3 -
  19. -... -abc -def -
  20. ----------------
  21. - 4 - 5 - 6 -
  22. -ghi -jkl -mno -
  23. ----------------
  24. - 7 - 8 - 9 -
  25. -pqrs-tuv -wxyz-
  26. ----------------
  27. ------ 0 ------
  28. ------|_| ------
  29. ----------------
  30.  
  31.  
  32. PS: Any special character apart from space maps to key 1. Space maps to key 0.
  33.  
  34.  
  35. Constraints:
  36. firstname can be [a-zA-Z_-,. ();]+ and 100 characters in length
  37. lastname can be [a-zA-Z_-,. ();]* and 100 characters in length
  38. number can be [0-9]+ and 20 characters in length
  39.  
  40. Input:
  41. First line contains N, 0<n<10^5, followed by N lines, with each line having format of
  42. First Name:Optional Lastname:Number
  43. Last line containing the string (of numbers) to be searched
  44.  
  45. Output:
  46. List of matches in contacts, arranged in increasing order of matching
  47. position, in format of
  48. First Name:Optional Lastname:Number
  49.  
  50. In case multiple matches have same matching position then according to the order in which they appear in the input.
  51.  
  52. In case no matches are found, then the string, “NOT FOUND” has to be printed without quotes.
  53.  
  54.  
  55.  
  56. Example:
  57. Input:
  58. 4
  59. Steve:Kilogo:837291091
  60. Mark:Lostworth:428204772
  61. Bill:Laker:256469278
  62. John:Mc millan:7778883929
  63. 5646
  64.  
  65. Output:
  66. John:Mc millan:7778883929
  67. Bill:Laker:256469278
  68. Steve:Kilogo:837291091
  69.  
  70.  
  71. Input:
  72. 3
  73. Gill:Shaw:61276374888
  74. Mary:Tudor:2818891889
  75. Rajiv:Ghosh:919928388011
  76. 8960
  77.  
  78. Output:
  79.  
  80. NOT FOUND
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement