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;
- using System.Threading.Tasks;
- namespace Problem_2.Manipulate_Array
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] arr = Console.ReadLine().Split(' ').ToArray();
- int lines = int.Parse(Console.ReadLine());
- var changeArray = arr;
- for (int i = 0; i < lines; i++)
- {
- string commands = Console.ReadLine();
- if (commands == "Distinct")
- {
- changeArray = changeArray.Distinct().ToArray();
- }
- if (commands == "Reverse")
- {
- Array.Reverse(changeArray);
- }
- if (commands != "Distinct" && commands != "Reverse")
- {
- string[] replace = commands.Split(' ').ToArray();
- changeArray[int.Parse(replace[1])] = replace[2];
- }
- }
- Console.WriteLine(string.Join(", ", changeArray));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement