Nested Dictionary


Темата е стара за C# от 2019,  но на Java не успях да намеря решение.  По-долу е условието. Ако може помощ за принтирането. Май и пълненето на маповете не е ок.

Nested Dictionary - Софтуерен университет (

Опит за решение: Nested -

You must read input lines until you receive the termination command “End”. On every input line (except the termination one) you will receive information in the following format:

“{person name} -> {liquid name}: {jars count}”

You must split the input and extract the needed information. Everything will be valid in the format described in the Input section.

You must collect all the different types of liquids for a person and sum the count of jars of every liquid for every person.


The information will be in the following format:

  • Person name – unique string which will not contain any of the characters that you have to split by (space, ‘-’, ‘>’, ‘:’)
  • Liquid name – unique string which will not contain any of the characters that you have to split by (space, ‘-’, ‘>’, ‘:’)
  • Jars count – integer number in range [0 … 100]


You must print all liquids for a single person with their count of jars.

Order the people by their name (ascending) and the liquids by their count (ascending).

{Person Name} Liquids:

--- {Liquid Name}: {Count}

--- {Liquid Name}: {Count}








Morgana -> Truelock: 2

Morgana -> Truelock: 89

Garrard -> Perigeaux: 96

Morgana -> Tott: 36

Arleta -> Sinnie: 15

Arleta -> Hutchin: 21

Emlyn -> Winslett: 92

Arleta -> Eam: 68


Arleta Liquids:

--- Sinnie: 15

--- Hutchin: 21

--- Eam: 68

Emlyn Liquids:

--- Winslett: 92

Garrard Liquids:

--- Perigeaux: 96

Morgana Liquids:

--- Tott: 36

--- Truelock: 91

Arleta is first because of the ordering (by names). The liquids are ordered by count of jars (ascending).