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