daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 53 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. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.  
  13.             var names = Console.ReadLine().Split().ToList();
  14.  
  15.  
  16.             while (true)
  17.             {
  18.                 string command = Console.ReadLine();
  19.                 if (command == "END") break;
  20.  
  21.                 else if (command == "Add visitor")
  22.                 {
  23.                     names.Add(Console.ReadLine());
  24.                 }
  25.  
  26.                 else if (command == "Add visitor on position")
  27.                 {
  28.                     string name = Console.ReadLine();
  29.                     names.Insert(int.Parse(Console.ReadLine()), name);
  30.                 }
  31.  
  32.                 else if (command == "Remove visitor on position")
  33.                 {
  34.                     names.RemoveAt(int.Parse(Console.ReadLine()));
  35.                 }
  36.  
  37.                 else if (command == "Remove last visitor") names.RemoveAt(names.Count - 1);
  38.  
  39.                 else if (command == "Remove first visitor") names.RemoveAt(0);
  40.                
  41.             }
  42.  
  43.             Console.WriteLine(string.Join(" ",names));
  44.  
  45.  
  46.         }
  47.     }
  48. }
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