#C3684. HTML Webpage Generator
HTML Webpage Generator
HTML Webpage Generator
You are given a mapping of countries to a list of languages spoken in each country. Your task is to generate an HTML formatted string that displays each country and its languages. The countries must be sorted in alphabetical order. For each country, the list of languages must also be sorted in alphabetical order.
The output should follow this structure:
- A header line with the country name wrapped in
<h2>
and</h2>
tags. - A list enclosed by
<ul>
and</ul>
tags. - Each language is displayed on its own line within the list, wrapped in
<li>
and</li>
tags with two leading spaces for indentation.
Mathematically, if we denote the set of countries as C and, for each country c \(\in C\), the associated list of languages as L(c), then the output should be generated for all c in \(\mathrm{sorted}(C)\) and for each language \(l\) in \(\mathrm{sorted}(L(c))\).
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
- The first line contains a single integer
N
, representing the number of countries. - The following lines describe each country in the following format:
- A line containing the country name (a string).
- A line containing an integer
M
denoting the number of languages for that country. M
lines each containing a language (a string).
outputFormat
Output the HTML formatted string to standard output (stdout). The output should consist of multiple lines as described:
<h2>CountryName</h2> <ul> <li>Language1</li> <li>Language2</li> ... </ul>
The countries and the languages for each country must be sorted in alphabetical order.
## sample3
USA
2
English
Spanish
France
1
French
India
3
Hindi
English
Tamil
France
- French
India
- English
- Hindi
- Tamil
USA
- English
- Spanish