private static void Main() { var numbers = new List<string>(); int numbersCount = int.Parse(Console.ReadLine()); for (int i = 0; i < numbersCount; i++) { string[] command = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string add = string.Empty; if (command[0] != command[3]) { if (command[2].ToLower() == "before") { add = command[0] + command[3]; } else { add = command[3] + command[0]; } numbers.Add(add); } } INumberRecover numberRecover = new NumberRecoverByBuildingGraph(numbers); string originalNumber = numberRecover.Recover(); Console.WriteLine(originalNumber); }
private static void Main() { var numbers = new List <string>(); int numbersCount = int.Parse(Console.ReadLine()); for (int i = 0; i < numbersCount; i++) { string[] command = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string add = string.Empty; if (command[0] != command[3]) { if (command[2].ToLower() == "before") { add = command[0] + command[3]; } else { add = command[3] + command[0]; } numbers.Add(add); } } INumberRecover numberRecover = new NumberRecoverByBuildingGraph(numbers); string originalNumber = numberRecover.Recover(); Console.WriteLine(originalNumber); }