Advertisement
Ronka

Untitled

Jun 12th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Arrays_MoreEx
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string[] arr = Console.ReadLine().Split(' ');
  14. int n = int.Parse(Console.ReadLine());
  15.  
  16. for (int i = 0; i < n; i++)
  17. {
  18. string[] input = Console.ReadLine().Split(' ');
  19. string command = input[0];
  20.  
  21. switch(command)
  22. {
  23. case "Reverse":
  24. Array.Reverse(arr);
  25. break;
  26. case "Distinct":
  27. arr = arr.Distinct().ToArray();
  28. break;
  29. case "Replace":
  30. int index = int.Parse(input[1]);
  31. arr[index] = input[2];
  32. break;
  33. }
  34. }
  35.  
  36. Console.Write(string.Join(", ", arr));
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement