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