Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, Dictionary<string, List<int>>> pokeDict =
- new Dictionary<string, Dictionary<string, List<int>>>();
- while (true)
- {
- string[] input = Console.ReadLine()
- .Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries)
- .ToArray();
- string pokemonName = input[0];
- string evolutionType;
- int evolutionIndex;
- if (input[0] == "wubbalubbadubdub")
- {
- break;
- }
- if (input.Length > 1)
- {
- evolutionType = input[1];
- evolutionIndex = int.Parse(input[2]);
- }
- else
- {
- if (pokeDict.ContainsKey(pokemonName))
- {
- PrintPokemonWithSpecialCommand(pokeDict, pokemonName);
- }
- continue;
- }
- if (!pokeDict.ContainsKey(pokemonName))
- {
- pokeDict.Add(pokemonName, new Dictionary<string, List<int>>());
- }
- if (!pokeDict[pokemonName].ContainsKey(evolutionType))
- {
- pokeDict[pokemonName].Add(evolutionType, new List<int>());
- }
- pokeDict[pokemonName][evolutionType].Add(evolutionIndex);
- }
- PrintCurrentPokemons(pokeDict);
- }
- private static void PrintPokemonWithSpecialCommand(Dictionary<string, Dictionary<string, List<int>>> pokeDict, string pokeM)
- {
- }
- private static void PrintCurrentPokemons(Dictionary<string, Dictionary<string, List<int>>> pokeDict)
- {
- foreach (var pokemon in pokeDict)
- {
- Dictionary<string, List<int>> pokemons = pokemon.Value;
- Console.WriteLine("# " + pokemon.Key);
- var pokes = pokemons.OrderByDescending(x => x.Value.Sum()).ToDictionary(z=>z.Key, a=>a.Value);
- foreach (var poke in pokes)
- {
- foreach (var l in poke.Value)
- {
- Console.WriteLine(poke.Key + " <-> " + l);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement