Guest User

Untitled

a guest
Sep 1st, 2017
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 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 Pokemon_Evolution
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string input = Console.ReadLine();
  14. var Dictionaty = new Dictionary<string,List<string>>();
  15. while (input != "wubbalubbadubdub")
  16. {
  17. var tokens = input.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries);
  18. string PokeName = tokens[0];
  19. if (tokens.Length > 1)
  20. {
  21. string EvolutionType = tokens[1];
  22. int Points = int.Parse(tokens[2]);
  23. if (!Dictionaty.ContainsKey(PokeName))
  24. {
  25. Dictionaty[PokeName] = new List<string>();
  26. }
  27. var pointsEvolutionType = EvolutionType + " <-> " + Points;
  28. Dictionaty[PokeName].Add(pointsEvolutionType);
  29.  
  30. }
  31. else
  32. {
  33. if (Dictionaty.ContainsKey(PokeName))
  34. {
  35. Console.WriteLine("# " + PokeName);
  36. foreach (var evolution in Dictionaty[PokeName])
  37. {
  38. Console.WriteLine(evolution);
  39. }
  40. }
  41. }
  42. input = Console.ReadLine();
  43. }
  44. foreach (var item in Dictionaty)
  45. {
  46. string Name = item.Key;
  47. Console.WriteLine("# " + Name);
  48. foreach (var TypeandNumber in item.Value.OrderByDescending(x => int.Parse(x.Split(new [] {" <-> "},StringSplitOptions.None).Skip(1).First())))
  49. {
  50. Console.WriteLine(TypeandNumber);
  51. }
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment