Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _04.Deserialize_String
- {
- class Program
- {
- static void Main(string[] args)
- {
- SortedDictionary<int, char> lettersIndex = new SortedDictionary<int, char>();
- string input = Console.ReadLine();
- while (input != "end")
- {
- string[] tokens = input.Split(':');
- char letter = tokens[0][0]; //[0] взимаме char стойноста на първия елем, з-то сме сигурни, че той е от тип char
- int[] indices = tokens[1].Split('/').Select(int.Parse).ToArray();
- foreach (int index in indices)
- {
- lettersIndex[index] = letter;
- }
- input = Console.ReadLine();
- }
- Console.WriteLine(lettersIndex.Values.ToArray());
- }
- }
- }
Add Comment
Please, Sign In to add comment