Question: The first line contains a single integer N the number of English words in the dictionary - followed by N dictionary entries. Each entry is

The first line contains a single integer N the number of English words in the dictionary - followed by N dictionary entries. Each entry is contained on a separate line, which contains first the English word, then a hyphen surrounded by spaces and then comma-separated list with the translations of this English word in Latin. All the words consist only of lowercase English letters. The translations are sorted in lexicographical order. The order of English words in the dictionary is also lexicographic.

Print the corresponding Latin-English dictionary in the same format. In particular, the first word line should be the lexicographically minimal translation of the Latin word, then second in that order, etc. The English words inside each line should also be sorted lexicographically.

Example input:

3 apple - malum, pomum, popula fruit - baca, bacca, popum punishment - malum, multa

Example output:

7 baca - fruit bacca - fruit malum - apple, punishment multa - punishment pomum - apple popula - apple popum - fruit

Has to be done in Java and has to use HashMaps

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javaioBufferedReader import javaioInputStreamReader import javautilArrayList import javautilCollections import javautilHashMap import javautilL... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!