You're writing an Android app whoch merges duplicate contacts from the Contact list of the user's phone.
2 contacts are considered duplicates phone numbers matches
Write a function to read contacts, merge duplicates and print the merged output to console
First line contains a single integer N, the number of contacts
Then N groups of lines follow, one group for each contact. Each group has the following format:
NOTE: You will be provided code snippets of functions to parse the input for and print the output to console. The code snippets will contain logic to print in ascending and too. You are requested not to change the code inside these snippets Doing to may as
vour program failing for certain test cases
• 1 <= N < 1000
• 0 <= P <= 10
• 0 <= U <= 1000000
No two contacts in the input will have the same value of U fast Uposte
• If one of the optional fields is blank, the special value "empt/will agent line for that field. This may happen for a birthdate or a phone number The see
empty' appearing in the input he should be treated as an empty string value. While printing output, if any of the values is ensely, you must pent its place.
• Assume that all inputs will be in valid format You dont need to validate the value . For example, assume that the birth-date validate the format need to validate
id format and you don't need to validate the format
Explanation:
'alice' and 'Alice Weasley' have the phone number '123456)
hence they're duplicates and merged in the final output.
The merged contact has the name *Alice Weasley because Weasley has the more recent last update time, 20.
'alice' has the birthdate '05-06-2000" present but *Alice W
the birthdate field empty.
The merged contacts has the
present, merged from the older contact, 'alice'.
Note: The 'empty' phone is printed first because the empty str
first in ascending order.
3
alice
05-06-2000
3
12345678 empty (022) 2456-7890
Bob Parson
empty
+9156728192
10
Alice Weasley
empty
2
12345678 98765432
20
Alice Weasley
05-06-2000
empty 12345678 (0221-2456-7890 9
20
Bob Parson
empty
+9156728192