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 _2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input;
- List<string> names = Console.ReadLine().Split(',').ToList();
- do
- {
- input = Console.ReadLine();
- switch (input)
- {
- case "Add visitor":
- string visitor = Console.ReadLine();
- names.Add(visitor);
- break;
- case "Add visitor on position":
- string visitor1 = Console.ReadLine();
- byte pos = byte.Parse(Console.ReadLine());
- names.Insert(pos, visitor1);
- break;
- case "Remove visitor on position":
- byte pos1 = byte.Parse(Console.ReadLine());
- names.RemoveAt(pos1);
- break;
- case "Remove last visitor":
- names.RemoveAt(names.Count-1);
- break;
- case "Remove first visitor":
- names.RemoveAt(0);
- break;
- }
- } while (input != "END");
- Console.WriteLine(string.Join(", ", names));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement