Advertisement
Ivakis

Untitled

Jun 30th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 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 P03_CameraView
  9. {
  10. class CameraView
  11. {
  12. static void Main(string[] args)
  13. {
  14. var pattern = @"(\|<\w+)";
  15.  
  16. var possitions = Console.ReadLine().Split();
  17. var text = Console.ReadLine();
  18.  
  19. var m = int.Parse(possitions[0]);
  20. var n = int.Parse(possitions[1]);
  21.  
  22. var matched = new List<string>();
  23.  
  24. MatchCollection matches = Regex.Matches(text, pattern);
  25.  
  26. foreach ( Match item in matches)
  27. {
  28. matched.Add(string.Join("", item.Value.Skip(m+2).Take(n).ToArray()));
  29. }
  30.  
  31. Console.WriteLine(string.Join(", ", matched));
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement