Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Hideout
- {
- using System;
- using System.Linq;
- using System.Text.RegularExpressions;
- public class StartUp
- {
- public static void Main()
- {
- string map = Console.ReadLine();
- while (true)
- {
- string[] clues = Console.ReadLine()
- .Trim()
- .Split(new string[] { " " }, StringSplitOptions
- .RemoveEmptyEntries)
- .ToArray();
- string hideout = clues[0];
- int minSize = int.Parse(clues[1]);
- string pattern = $@"[{hideout}]+";
- foreach (Match item in Regex.Matches(map, pattern))
- {
- if (item.Length >= minSize)
- {
- Console.WriteLine($"Hideout found at index {item.Index} and it is with size {item.Length}!");
- return;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement