Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _04._Snowwhite
- {
- class Snowwhite
- {
- static void Main()
- }
- Dictionary<string, int> dwarfs = new Dictionary<string, int>();
- string input = string.Empty;
- while ((input = Console.ReadLine()) != "Once upon a time")
- {
- string[] args = input.Split(new[] {' ', '<', ':', '>' }, StringSplitOptions.RemoveEmptyEntries);
- string name = "("+args[1]+")"+ " "+args[0];
- int physics = int.Parse(args[2]);
- if (!dwarfs.ContainsKey(name))
- {
- dwarfs.Add(name,0);
- }
- dwarfs[name]=physics;
- }
- foreach (var dwarf in dwarfs.OrderByDescending(x=>x.Value).ThenByDescending(x=>x.Key.Count()))
- {
- Console.WriteLine($"{dwarf.Key} <-> {dwarf.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement