Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace strong_number
- {
- class Program
- {
- static void Main()
- {
- // manipulation basics
- List<int> numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- for (int i =0; i<numbers.Count-1; i++)
- {
- string[] command = Get().Split(' ');
- if (command[0] == "end") { Console.WriteLine(string.Join(" ", numbers)); break; }
- if(command[0] == "Add")
- {
- numbers.Add(Convert.ToInt32(command[1]));
- }
- if (command[0] == "Remove")
- {
- numbers.Remove(Convert.ToInt32(command[1]));
- }
- if (command[0] == "RemoveAt")
- {
- numbers.RemoveAt(Convert.ToInt32(command[1]));
- }
- if (command[0] == "Insert")
- {
- int index = Convert.ToInt32(command[2]) ;
- numbers.Insert(index,Convert.ToInt32( command[1]));
- }
- }
- }
- static string Get() { return Console.ReadLine(); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement