| 12345678910111213141516171819 |
- using System;
- using System.IO;
- using System.Text.RegularExpressions;
- namespace D07._1
- {
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length < 1) throw new ArgumentException();
- if (File.Exists(args[0]) == false) throw new FileNotFoundException();
- var r = new Regex(@"(?!^.*\[\w*(\w)(?!\1)(\w)\2\1\w*\])^.*(\w)(?!\3)(\w)\4\3", RegexOptions.Multiline)
- .Matches(File.ReadAllText(args[0]));
- Console.WriteLine($"The answer is : {r.Count}");
- }
- }
- }
|