Infiniti_Inter

13 Practic

Oct 28th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7. namespace ConsoleApp1
  8. {
  9.  
  10.  
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.  
  16.             Regex a = new Regex(@"\s[0,1][0-9]|[2][0,1,2,3]:[0-5][0-9]:[0-5][0-9]\s");
  17.             string s = @"
  18.                        22:02:2000 f
  19.                        22:21:50   t
  20.                        23:21:59   t
  21.                        22:61:24   f
  22.                        ";
  23.             Match list = a.Match(s);
  24.             int ans = 0;
  25.             while (list.Success)
  26.             {
  27.                 ans++;
  28.                 list = list.NextMatch();
  29.             }
  30.             Console.WriteLine(ans);
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment