allia

мерлин

Feb 10th, 2021 (edited)
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Text;  
  3. using System.Text.RegularExpressions;
  4.  
  5. class MainClass
  6. {
  7.   public static void Main (string[] args)
  8.   {
  9.     int index = 0;
  10.     string merl = @"^Merlin\s*speaks";
  11.     string kill = @"Avada-ke-davra";
  12.     string str = Console.ReadLine();
  13.  
  14.     while(true)
  15.     {
  16.       index = index + 1;
  17.       var merlin = Regex.Match(str, merl);
  18.         if(merlin.Success)
  19.             foreach (Match match in Regex.Matches(str, kill))
  20.                  Console.WriteLine($"{index} {match.Index + 1}");
  21.  
  22.           str = Console.ReadLine();
  23.           if (String.IsNullOrEmpty(str))
  24.            break;
  25.    }
  26.  }
  27. }
Add Comment
Please, Sign In to add comment