Exemple #1
0
        static void Main(string[] args)
        {
            var addCollection       = new AddCollection();
            var addRemoveCollection = new AddRemoveCollection();
            var myList = new MyList();

            var input            = Console.ReadLine().Split();
            var numberOfRemovals = int.Parse(Console.ReadLine());

            Console.WriteLine(addCollection.Add(input));
            Console.WriteLine(addRemoveCollection.Add(input));
            Console.WriteLine(myList.Add(input));
            Console.WriteLine(addRemoveCollection.Remove(numberOfRemovals));
            Console.WriteLine(myList.Remove(numberOfRemovals));
        }
Exemple #2
0
        public static void Main()
        {
            var addCollection       = new AddCollection();
            var addRemoveCollection = new AddRemoveCollection();
            var myList = new MyList();

            var input = Console.ReadLine().Split();


            foreach (string element in input)
            {
                Console.Write($"{addCollection.Add(element)} ");
            }

            Console.WriteLine();

            foreach (string element in input)
            {
                Console.Write($"{addRemoveCollection.Add(element)} ");
            }

            Console.WriteLine();

            foreach (string element in input)
            {
                Console.Write($"{myList.Add(element)} ");
            }

            Console.WriteLine();

            int removeOperationsCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < removeOperationsCount; i++)
            {
                Console.Write($"{addRemoveCollection.Remove()} ");
            }

            Console.WriteLine();

            for (int i = 0; i < removeOperationsCount; i++)
            {
                Console.Write($"{myList.Remove()} ");
            }

            Console.WriteLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            AddCollection       ac  = new AddCollection();
            AddRemoveCollection arc = new AddRemoveCollection();
            MyList ml = new MyList();

            var input = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in input)
            {
                Console.Write($"{ac.Add(item)} ");
            }
            Console.WriteLine();

            foreach (var item in input)
            {
                Console.Write($"{arc.Add(item)} ");
            }
            Console.WriteLine();

            foreach (var item in input)
            {
                Console.Write($"{ml.Add(item)} ");
            }
            Console.WriteLine();

            int count = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                Console.Write($"{arc.Remove()} ");
            }
            Console.WriteLine();

            for (int i = 0; i < count; i++)
            {
                Console.Write($"{ml.Remove()} ");
            }
            Console.WriteLine();
        }
        static void Main()
        {
            var elements = Console.ReadLine().Split();

            var addCollection       = new AddCollection();
            var addRemoveCollection = new AddRemoveCollection();
            var myList = new MyList();

            var addCollectionIndices        = new List <int>();
            var removableCollectionsIndices = new List <int>();

            foreach (var element in elements)
            {
                addCollectionIndices.Add(addCollection.Add(element));

                addRemoveCollection.Add(element);
                myList.Add(element);

                removableCollectionsIndices.Add(0);
            }

            var countOfRemoveOperations = int.Parse(Console.ReadLine());

            var addRemoveCollectionRemovedElements = new List <string>();
            var myListRemovedElements = new List <string>();

            for (int counter = 0; counter < countOfRemoveOperations; counter++)
            {
                addRemoveCollectionRemovedElements.Add(addRemoveCollection.Remove());
                myListRemovedElements.Add(myList.Remove());
            }

            Console.WriteLine(string.Join(' ', addCollectionIndices));
            Console.WriteLine(string.Join(' ', removableCollectionsIndices));
            Console.WriteLine(string.Join(' ', removableCollectionsIndices));
            Console.WriteLine(string.Join(' ', addRemoveCollectionRemovedElements));
            Console.WriteLine(string.Join(' ', myListRemovedElements));
        }