o_ignatov

camera view solved

Jul 3rd, 2017
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _03CameraView
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
  15. int skip = nums[0];
  16. int take = nums[1];
  17.  
  18. string pattern = "\\|<(\\w{" + skip + "})(\\w{0," + take + "})";
  19. string input = Console.ReadLine();
  20. MatchCollection matchedResult = Regex.Matches(input, pattern);
  21. List<string> res = new List<string>();
  22. foreach (Match m in matchedResult)
  23. {
  24. res.Add(m.Groups[2].Value);
  25. }
  26. Console.WriteLine(string.Join(", ", res));
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment