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 _02MoreExcercisesManipulateArray
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- string[] myArr = Console.ReadLine().Split().ToArray();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string[] input = Console.ReadLine().Split().ToArray();
- if (input[0] == "Distinct" )
- {
- myArr=myArr.Distinct().ToArray();
- }
- else if (input[0] == "Reverse")
- {
- myArr = myArr.Reverse().ToArray();
- }
- else if (input[0] == "Replace")
- {
- myArr[int.Parse(input[1])] = input[2];
- }
- }
- Console.Write(string.Join(", ",myArr));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement