Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. namespace TseamAccount
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6.  
  7. class Program
  8. {
  9. public static void Main()
  10. {
  11. List<string> gameCollections = Console.ReadLine().Split().ToList();
  12.  
  13. string[] input = Console.ReadLine().Split();
  14.  
  15. while (input[0] != "Play!")
  16. {
  17. string command = input[0];
  18. string gameName = input[1];
  19.  
  20. if (command == "Install")
  21. {
  22. if (!gameCollections.Contains(gameName))
  23. {
  24. gameCollections.Add(gameName);
  25. }
  26. }
  27. else if (command == "Uninstall")
  28. {
  29. if (gameCollections.Contains(gameName))
  30. {
  31. gameCollections.Remove(gameName);
  32. }
  33. }
  34. else if (command == "Update")
  35. {
  36. if (gameCollections.Contains(gameName))
  37. {
  38. gameCollections.Remove(gameName);
  39. gameCollections.Add(gameName);
  40. }
  41. }
  42. else if (command == "Expansion")
  43. {
  44. string game = gameName.Split('-')[0];
  45. string expansion = gameName.Split('-')[1];
  46.  
  47. if (gameCollections.Contains(game))
  48. {
  49. int index = gameCollections.IndexOf(game);
  50.  
  51. gameCollections.Insert(index + 1, game + ':' + expansion);
  52. }
  53. }
  54.  
  55. input = Console.ReadLine().Split();
  56. }
  57.  
  58. Console.WriteLine(string.Join(" ", gameCollections));
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement