Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApp6
- {
- class Program
- {
- static void Main(string[] args)
- {
- // read list of integers
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- while (true)
- {
- List<string> command = Console.ReadLine().Split().ToList();
- if (command[0] == "end")
- {
- break;
- }
- if (command[0] == "Add")
- {
- numbers.Add(int.Parse(command[1]));
- }
- else if (command[0] == "Insert")
- {
- numbers.Insert(int.Parse(command[2]), int.Parse(command[1]));
- }
- else if (command[0] == "Remove")
- {
- numbers.RemoveAt(int.Parse(command[1]));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment