Question: Please help me answer this simple coding question for an online judge platform in Java 8. Please also provide screenshots of your output after entering
Please help me answer this simple coding question for an online judge platform in Java 8. Please also provide screenshots of your output after entering the inputs; it should match the sample inputs and outputs in the question. Thank You!
The o in the input is the first city name and the d is the second city name for the lines in the input that have two names.


The bad thing about being an international Man of Mystery (MoM) is there's usually someone who wants to kill you. Sometimes you have to stay on the run just to stay alive. You have to think ahead. You have to make sure you don't end up trapped somewhere with no escape. Of course, not all MoMs are blessed with a great deal of intelligence. You are going to write a program to help them out. You are going to make sure our MoM knows what cities are safe to visit and which are not. It's not enough to just be able to run (or fly) for one or two days, we have to guarantee that the MoM can keep running for as long as might be necessary. Given a list of regular, daily flights between pairs of cities, you are going to make sure our MoM never gets stuck in a city from which there is no escape. We'll say there is an escape from some location if there is an infinitely long sequence of cities the MoM could fly to making one flight each day. Input Input starts with a number, 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
