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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- var names = Console.ReadLine().Split().ToList();
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "END") break;
- else if (command == "Add visitor")
- {
- names.Add(Console.ReadLine());
- }
- else if (command == "Add visitor on position")
- {
- string name = Console.ReadLine();
- names.Insert(int.Parse(Console.ReadLine()), name);
- }
- else if (command == "Remove visitor on position")
- {
- names.RemoveAt(int.Parse(Console.ReadLine()));
- }
- else if (command == "Remove last visitor") names.RemoveAt(names.Count - 1);
- else if (command == "Remove first visitor") names.RemoveAt(0);
- }
- Console.WriteLine(string.Join(" ",names));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement