Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- namespace Demo
- {
- class Program
- {
- static void Main()
- {
- StringBuilder sb = new StringBuilder();
- while (true)
- {
- string line = Console.ReadLine().Trim();
- if (line == "DEBUG")
- break;
- sb.Append($"{line} ");
- }
- string text = sb.ToString().Trim();
- Regex regex = new Regex(@"32656 19759 32763 0 (?<size>\d+) 0 ");
- MatchCollection matches = regex.Matches(text);
- foreach (Match match in matches)
- {
- int startingIndex = match.Index + match.Value.Length;
- int takeCount = int.Parse(match.Groups["size"].Value);
- IEnumerable<char> symbols = text.Substring(startingIndex)
- .Split()
- .Select(int.Parse)
- .Select(s => (char)s)
- .Take(takeCount);
- string word = string.Concat(symbols);
- Console.WriteLine(word);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement