Mixed phones problem - dictionaries exercises
Здравейте, колеги! Много ще съм благодарен ако помогнете с тази задача. Не разбирам защо не ми парсва на "johnny" номера на един от нулевите тестове.
Условието:
You will be given several phone entries, in the form of strings in format:
{firstElement} : {secondElement}
The first element is usually the person’s name, and the second one – his phone number. The phone number consists ONLY of digits, while the person’s name can consist of any ASCII characters.
Sometimes the phone operator gets distracted by the Minesweeper she plays all day, and gives you first the phone, and then the name. e.g. : 0888888888 : Pesho. You must store them correctly, even in those cases.
When you receive the command “Over”, you are to print all names you’ve stored with their phones. The names must be printed in alphabetical order.
Examples
Input
|
Output
|
14284124 : Alex
Gosho : 088423123
Ivan : 412048192
123123123 : Nanyo
Pesho : 150925812
Over
|
Alex -> 14284124
Gosho -> 88423123
Ivan -> 412048192
Nanyo -> 123123123
Pesho -> 150925812
|
Ivan : 13213456
GeorgeThe2nd : 131313
Johnny : 5556322312
Donald : 3212
Over
|
Donald -> 3212
GeorgeThe2nd -> 131313
Ivan -> 13213456
Johnny -> 5556322312
|
ето и кода ми: http://pastebin.com/y7m265sH