Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace MapDistricts
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class Program
- {
- public static void Main(string[] args)
- {
- Dictionary<string, int[]> townsAndPopulation = Console.ReadLine()
- .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(s =>
- {
- return new KeyValuePair<string, int>(s.Split(':')[0], int.Parse(s.Split(':')[1]));
- })
- .GroupBy(k => k.Key)
- .ToDictionary(key => key.Key, value => value.Select(s => s.Value).ToArray());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement