Advertisement
Stan08

MoreRegex/7.Hideout

Jun 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Linq;
  4. using System.Globalization;
  5. using System.Collections.Generic;
  6. using System.Text;
  7.  
  8. public class Example
  9.  
  10. {
  11. public static void Main(string[] args)
  12.  
  13. {
  14. string map = Console.ReadLine();
  15.  
  16. while(true)
  17. {
  18. string [] clues = Console.ReadLine().Split().ToArray();
  19.  
  20. string trace ="\\"+clues[0]+"+";
  21. MatchCollection m = Regex.Matches(map, trace);
  22.  
  23. foreach (Match tr in m)
  24. {
  25. if (tr.Length>=int.Parse(clues[1]))
  26. {
  27. Console.WriteLine($"Hideout found at index {tr.Index} and it is with size {tr.Length}!");
  28. return;
  29. }
  30. }
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement