Description
One final task for Sam before he gets to go home… Data mining!
Sam will receive info about one or several people in the format
• “{name}={key}:{value};{key}:{value};…”.
The goal here is to group the info for every person by their name. If a key is received multiple times, keep only the most recent value.
On the last line, you will receive “Kill {name}”. Your task is to find all the info on that name and print it, ordered alphabetically by key.
Then, Sam needs to build a so-called info index on them. The info index is comprised of the sum of all the keys’ lengths and values’ lengths of that person’s info.
If the info index is larger or equal to the target info index (given on the first line of input), print “Proceed”. Otherwise, print “Need {infoNeeded} more info.“.
Input
• On the first line, you will receive the target info index, an integer in the range [25-90]
• Until you receive the text “end transmissions”, keep reading new lines with information. • On the final line, you will receive “Kill {name}”
Output
• On the first line, print “Info on {name}:”.
• On the next lines, print “—{info}: {value}”
• On the next line, print “Info index: {infoIndex}” with the info index of the selected person.
• On the final line, print either “Proceed” or “Need {infoNeeded} more info.”, depending on whether the info is enough to carry out the hit or not.
Constraints
• There will always be at least one name in the input.
• Each name will always have one or several key/value pairs associated with it.
Examples
Input Output
30
Kobin=age:20;salary:700
end transmissions
Kill Kobin Info on Kobin:
—age: 20
—salary: 700
Info index: 34
Proceed
20
Lambert=age:57;salary:7000
Grimsdottir=salary:5000
John=salary:1550
John=lastName:Smith
John=salary:1800
end transmissions
Kill Lambert Info on Lambert:
—age: 57
—salary: 7000
Info index: 15
Need 5 more info.
25
Bill=salary:900;lastName:Billov
Kobin=salary:1300
end transmissions
Kill Bill Info on Bill:
—lastName: Billov
—salary: 900
Info index: 23
Need 2 more info.




Reviews
There are no reviews yet.