← 返回 reddit 的题目列表Print Report Chain
类型:online_judge
reddit
Given a set of employee-supervisor relationships, print the complete report chain for a specific employee. The input is a table of employee-supervisor pairs, and you are given the name of an employee. Output the complete report chain for that employee (from the employee to the top-most supervisor).
For example, if the relationships are:
A -> B
B -> C
C -> D
And the input employee is A, the output should be: A -> B -> C -> D.
Example
Input
['A -> B', 'B -> C', 'C -> D']
A