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