Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ListsEx
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = new List<int>(Console.ReadLine().Split(" ").Select(int.Parse).ToList());
- while (true)
- {
- var line = Console.ReadLine();
- if (line == "end")
- {
- break;
- }
- string[] linecommand = line.Split(" ");
- switch (linecommand[0])
- {
- case "Delete":
- int number = int.Parse(linecommand[1]);
- input.Remove(number);
- break;
- case "Insert":
- int element = int.Parse(linecommand[1]);
- int position = int.Parse(linecommand[2]);
- input.Insert(position, element);
- break;
- }
- }
- Console.WriteLine(string.Join(" ", input));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement