Advertisement
simonradev

Asd

Jun 15th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. namespace MapDistricts
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6.  
  7. public class Program
  8. {
  9. public static void Main(string[] args)
  10. {
  11. Dictionary<string, int[]> townsAndPopulation = Console.ReadLine()
  12. .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
  13. .Select(s =>
  14. {
  15. return new KeyValuePair<string, int>(s.Split(':')[0], int.Parse(s.Split(':')[1]));
  16. })
  17. .GroupBy(k => k.Key)
  18. .ToDictionary(key => key.Key, value => value.Select(s => s.Value).ToArray());
  19.  
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement