Advertisement
YavorGrancharov

Deserialize_String(text_process)

Aug 5th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Deserialize_String
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string input = Console.ReadLine();
  13.  
  14.             StringBuilder index = new StringBuilder(new string(' ', 500));
  15.  
  16.             while (input != "end")
  17.             {
  18.                 string[] tokens = input.Split(':');
  19.                 char letter = char.Parse(tokens[0]);
  20.                 List<int> indexes = tokens[1].Split('/').Select(int.Parse).ToList();
  21.  
  22.                 foreach (var num in indexes)
  23.                 {
  24.                     index[num] = letter;
  25.                 }
  26.  
  27.                 input = Console.ReadLine();
  28.             }
  29.             Console.WriteLine(index.ToString());
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement