Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- List<string> numbers = Console.ReadLine().Split().ToList();
- string[] command = Console.ReadLine().Split().ToArray();
- while (command[0] != "END")
- {
- if (command[0] == "Change")
- {
- if (numbers.Contains(command[1]))
- {
- int index = numbers.IndexOf(command[1]);
- numbers[index] = command[2];
- }
- }
- if (command[0] == "Hide")
- {
- if (numbers.Contains(command[1]))
- {
- numbers.Remove(command[1]);
- }
- }
- if (command[0] == "Switch")
- {
- if (numbers.Contains(command[1]) && numbers.Contains(command[2]))
- {
- int index1 = numbers.IndexOf(command[1]);
- int index2 = numbers.IndexOf(command[2]);
- numbers[index1] = command[2];
- numbers[index2] = command[1];
- }
- }
- if (command[0] == "Insert")
- {
- int index = int.Parse(command[1]) + 1;
- if (index >= 0 && index < numbers.Count)
- {
- numbers.Insert(index, command[2]);
- }
- }
- if (command[0] == "Reverse")
- {
- numbers.Reverse();
- }
- command = Console.ReadLine().Split().ToArray();
- }
- Console.WriteLine(string.Join(" ",numbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement