Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Tseam_Account
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> Games = Console.ReadLine().Split().ToList();
- List<string> NewList = new List<string>();
- string line = Console.ReadLine();
- while (line != "Play!")
- {
- string[] tokens = line.Split();
- string comand = tokens[0];
- string game = tokens[1];
- if (comand == "Install")
- {
- if (NewList.Contains(game) == false)
- {
- Games.Add(game);
- NewList.Add(game);
- }
- }
- else if (comand == "Uninstall")
- {
- if (Games.Contains(game) == true)
- {
- Games.Remove(game);
- }
- }
- else if (comand == "Update")
- {
- if (Games.Contains(game) == true)
- {
- Games.Remove(game);
- Games.Add(game);
- }
- }
- else if (comand == "Expansion")
- {
- if (Games.Contains(game))
- {
- string[] tok = game.Split('-');
- string gameName = tok[0];
- string expansion = tok[1];
- if (Games.Contains(gameName))
- {
- int index = Games.IndexOf(gameName);
- string value = $"{gameName}:{expansion}";
- if (index == Games.Count - 1)
- {
- Games.Add(value);
- }
- else
- {
- Games.Insert(index + 1, value);
- }
- }
- }
- }
- line = Console.ReadLine();
- }
- Console.WriteLine(string.Join(" ", Games));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement