Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _09072017Pr4
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- var allPokemons = new Dictionary<string, List<KeyValuePair<string, int>>>();
- var input = string.Empty;
- while (!(input = Console.ReadLine()).Equals("wubbalubbadubdub"))
- {
- var tokens = input.Split(new[] { ' ', '-', '>' }, StringSplitOptions.RemoveEmptyEntries);
- if (tokens.Length == 1)
- {
- var pokemonName = tokens[0];
- if (!allPokemons.ContainsKey(pokemonName)) continue;
- Console.WriteLine($"# {pokemonName}");
- foreach (var pokemon in allPokemons[pokemonName])
- {
- Console.WriteLine($"{pokemon.Key} <-> {pokemon.Value}");
- }
- }
- else
- {
- var pokemonType = tokens[0];
- var pokemonEvo = tokens[1];
- var pokemonIndex = int.Parse(tokens[2]);
- if (!allPokemons.ContainsKey(pokemonType))
- {
- allPokemons.Add(pokemonType, new List<KeyValuePair<string, int>>());
- }
- allPokemons[pokemonType].Add(new KeyValuePair<string, int>(pokemonEvo, pokemonIndex));
- }
- }
- foreach (var pokemonType in allPokemons)
- {
- Console.WriteLine($"# {pokemonType.Key}");
- foreach (var pokemonStat in pokemonType.Value.OrderByDescending(p => p.Value))
- {
- Console.WriteLine($"{pokemonStat.Key} <-> {pokemonStat.Value}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement