G.W. Coding Contest 2 P4: Giving to Guidance
The staff at Dr. G.W. Williams are having trouble scheduling students for next semester, so they have offloaded the work onto you! Given a students \(N\) courses, and \(M\) boundaries of the schedule, return the scheduled order of the courses. A boundary is defined as course \(A\) must come before course \(B\).
The first line of input will contain two integers, \(N\) and \(M\), where \(N\) is an integer representing the number of courses and \(M\) is an integer representing the number of boundaries.
The next \(N\) lines will contain each of the course names
The next \(M\) lines will contain two strings representing the names of the courses. The course that appears first must come before the course that appears second in each line.
Any possible output will be accepted. There will always be some correct answer.
The output will contain \(N\) strings, representing the correct order of the courses.
Each string should be seperated by only one space, including the final string. Any mismatching whitespace will graded as incorrect.
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
Submit Solution