Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }