Advertisement
North_Point

tetovae3

Aug 9th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Collections.Generic;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace Demo
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             StringBuilder sb = new StringBuilder();
  14.  
  15.             while (true)
  16.             {
  17.                 string line = Console.ReadLine().Trim();
  18.  
  19.                 if (line == "DEBUG")
  20.                     break;
  21.  
  22.                 sb.Append($"{line} ");
  23.             }
  24.  
  25.             string text = sb.ToString().Trim();
  26.  
  27.             Regex regex = new Regex(@"32656 19759 32763 0 (?<size>\d+) 0 ");
  28.  
  29.             MatchCollection matches = regex.Matches(text);
  30.  
  31.             foreach (Match match in matches)
  32.             {
  33.                 int startingIndex = match.Index + match.Value.Length;
  34.                 int takeCount = int.Parse(match.Groups["size"].Value);
  35.  
  36.                 IEnumerable<char> symbols = text.Substring(startingIndex)
  37.                     .Split()
  38.                     .Select(int.Parse)
  39.                     .Select(s => (char)s)
  40.                     .Take(takeCount);
  41.  
  42.                 string word = string.Concat(symbols);
  43.                 Console.WriteLine(word);
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement