Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Test_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> names = Console.ReadLine().Split(',').ToList();
- string comand = Console.ReadLine();
- while(comand != "END")
- {
- switch (comand)
- {
- case "Add visitor":
- string visitor = Console.ReadLine();
- names.Add(visitor);
- break;
- case "Add visitor on position":
- string newV = Console.ReadLine();
- int index = int.Parse(Console.ReadLine());
- names.Insert(index, newV);
- break;
- case "Remove visitor on position":
- index = int.Parse(Console.ReadLine());
- names.Remove(names[index]);
- break;
- case "Remove last visitor":
- names.Remove(names[names.Count - 1]);
- break;
- case "Remove first visitor":
- names.Remove(names.First());
- break;
- }
- comand = Console.ReadLine();
- }
- Console.WriteLine(string.Join(", ", names));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement