Advertisement
Guest User

P03._Camera_View

a guest
Feb 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. namespace P03._Camera_View
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
  13.             string text = Console.ReadLine();
  14.             string pattern = @"[|<]+([\w]{" + numbers[0] + @"})([\w]{0," + numbers[1] +@"})";
  15.  
  16.             MatchCollection match = Regex.Matches(text, pattern);
  17.  
  18.             List<string> result = new List<string>();
  19.  
  20.             foreach (Match m in match)
  21.             {
  22.                 result.Add(m.Groups[2].Value);
  23.             }
  24.             Console.WriteLine(string.Join(", ",result));
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement