SHARE
TWEET

Untitled

a guest Oct 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace ConsoleApp2
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.  
  12.             List<int> list = Console.ReadLine().Split(" ").Select(int.Parse).ToList();
  13.  
  14.             string line = Console.ReadLine();
  15.  
  16.  
  17.  
  18.  
  19.             while (line != "end")
  20.             {
  21.                 string[] command = line.Split(" ").ToArray();
  22.                 if (command[0] == "Delete")
  23.                 {
  24.                     list.RemoveAll(item => item == int.Parse(command[1]));
  25.                 }
  26.                 else if (command[0] == "Insert")
  27.                 {
  28.                     list.Insert(int.Parse(command[2]), int.Parse(command[1]));
  29.  
  30.  
  31.                 }
  32.                 line = Console.ReadLine();
  33.  
  34.             }
  35.             Console.WriteLine(string.Join(" ", list));
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top