Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- string input = string.Empty;
- List<int> number = Console.ReadLine().Split().Select(int.Parse).ToList();
- while((input = Console.ReadLine()) != "end")
- {
- List<string> command = input.Split().ToList();
- int amount = int.Parse(command[1]);
- if (command[0] == "Add")
- {
- number.Add(amount);
- }
- else if (command[0] == "Remove")
- {
- number.Remove(amount);
- }
- else if (command[0] == "RemoveAt")
- {
- number.RemoveAt(amount);
- }
- else if (command[0] == "Insert")
- {
- int index = int.Parse(command[2]);
- number.Insert(index, amount);
- }
- }
- Console.WriteLine(string.Join(" ", number));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement