Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2017
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 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 _2_3.Booming_Cannon
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. var inputLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
  15. int n = inputLine[0];
  16. int m = inputLine[1];
  17.  
  18. var input = Console.ReadLine();
  19.  
  20. var target = new List<string>();
  21.  
  22. var pattern = @"(?<=\\[<]{3})\w+";
  23. var reg = new Regex(pattern);
  24.  
  25. var text = reg.Matches(input).Cast<Match>().Select(v => v.Value).ToList();
  26.  
  27. foreach (var item in text)
  28. {
  29. if (item.Length >= (n + m))
  30. {
  31. target.Add(item.Remove(0, n).Substring(0, m));
  32. }
  33. else
  34. {
  35. return;
  36. }
  37. }
  38. Console.WriteLine(string.Join("/\\", target));
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement