Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement