fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var strs = new List<string> { "012W212222123", "012W764444443"};
  12. foreach (var s in strs)
  13. Console.WriteLine("{0}: {1}", s, Regex.IsMatch(s, @"^(?!.*(.)\1{4})"));
  14. }
  15. }
Success #stdin #stdout 0.03s 30152KB
stdin
Standard input is empty
stdout
012W212222123: True
012W764444443: False