Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- var letterIndices = new SortedDictionary<char, int[]>();
- while (true)
- {
- var line = Console.ReadLine();
- if (line == "end")
- {
- break;
- }
- var tokens = line.Split(':');
- var letter = tokens[0][0];
- var indices = tokens[1].Split('/').Select(int.Parse).ToArray();
- letterIndices[letter] = indices;
- }
- var flattened = new SortedDictionary<int, char>();
- foreach (var kvp in letterIndices)
- {
- foreach (var index in kvp.Value)
- {
- flattened[index] = kvp.Key;
- }
- }
- var result = new string(flattened.Values.ToArray());
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement