Example #1
0
        private static void CharSequenceSolution()
        {
            var numberOfCases = int.Parse(Console.ReadLine());

            for (int inputIndex = 0; inputIndex < numberOfCases; inputIndex++)
            {
                var testCase = Console.ReadLine();
                var sequence = new CharSequence(testCase.Length);

                for (int i = 0; i < testCase.Length; i++)
                {
                    var key = testCase[i];
                    if (key == '<')
                    {
                        sequence.MoveLeft();
                    }
                    else if (key == '>')
                    {
                        sequence.MoveRight();
                    }
                    else if (key == '-')
                    {
                        sequence.Remove();
                    }
                    else
                    {
                        sequence.Add(key);
                    }
                }

                Console.WriteLine(sequence.ToString());
            }
        }