Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ChangeList
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> num = Console.ReadLine()
- .Split(" ", StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .ToList();
- string[] command = Console.ReadLine()
- .ToUpper()
- .Split()
- .ToArray();
- while (command[0] != "END")
- {
- switch (command[0])
- {
- case "DELETE":
- for (int i = 0; i < num.Count; i++)
- {
- num.Remove(int.Parse(command[1]));
- }
- break;
- case "INSERT":
- num.Insert(int.Parse(command[2]) , int.Parse(command[1]));
- break;
- }
- command = Console.ReadLine()
- .ToUpper()
- .Split()
- .ToArray();
- }
- Console.WriteLine(string.Join(" ", num));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement