#K89292. Organizational Chart Formatter
Organizational Chart Formatter
Organizational Chart Formatter
In this problem, you are given a list of employee-manager pairs describing the organizational structure of a company. Each pair comprises an employee and his/her manager. The CEO is uniquely determined by having "None" as their manager. Your task is to generate a hierarchical organizational chart, starting with the CEO, using tab indentation (\t) for each level.
The hierarchy must be printed such that the subordinates of each manager are sorted in ascending lexicographical order. Formally, if an employee X manages a set of employees, they must be output in order, with a tab character added before each subordinate line relative to X's line.
You can assume that the number of employees satisfies \(1 \leq n \leq 1000\). The input will be given via standard input (stdin) and the output should be printed on standard output (stdout).
Note: All formulas, if any, are formatted using \(\LaTeX\) for clarity.
inputFormat
The first line of input contains an integer \(n\) (\(1 \leq n \leq 1000\)) representing the number of employees. Each of the following \(n\) lines contains two space-separated strings: an employee name and their manager's name.
If the manager's name is "None", then the employee is the CEO. Otherwise, the line represents the relationship that the given employee reports to the specified manager.
outputFormat
Output the organizational chart in a hierarchical format on standard output (stdout). The CEO should be printed on the first line without any indentation. For every subordinate of a manager, print their name on a new line with one additional tab character (\t) of indentation compared to their manager. The subordinates for each manager must be listed in ascending lexicographical order.
## sample8
Alice None
Bob Alice
Charlie Alice
David Bob
Eve Bob
Frank Charlie
Grace Charlie
Heidi David
Alice
Bob
David
Heidi
Eve
Charlie
Frank
Grace</code></pre>