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;
- using System.Globalization;
- using System.Numerics;
- namespace ConsoleApp97
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> text = Console.ReadLine()
- .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- int n = int.Parse(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- {
- string[] commands = Console.ReadLine().Split(' ').ToArray();
- if (commands[0] == "Reverse")
- {
- text.Reverse();
- }
- if(commands[0] == "Replace")
- {
- int index = int.Parse(commands[1]);
- string element = commands[2];
- text.RemoveAt(index);
- text.Insert(index, element);
- }
- if (commands[0] == "Distinct")
- {
- text = text.Distinct().ToList();
- }
- }
- Console.WriteLine(string.Join(", ", text));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement