Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- List<int> originalList = Console.ReadLine().Split().Select(int.Parse).ToList();
- string input = string.Empty;
- while((input = Console.ReadLine()) != "end")
- {
- string[] arr = input.Split();
- string command = arr[0];
- int element = int.Parse(arr[1]);
- if (command == "Delete")
- {
- originalList.RemoveAll(x => x == element);
- }
- else
- {
- int index = int.Parse(arr[2]);
- originalList.Insert(index, element);
- }
- }
- Console.WriteLine(string.Join(" ", originalList));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement