using System.Text.RegularExpressions; public class Program { static void Main() { string s = "12345678901234567890123456789012"; var match = s.Length >=1 && s.Length <=100 && Regex.Match(s, "^[a-zA-Z0-9_-]{1,31}$").Success && !Regex.Match(s, "^[-_]").Success && !Regex.Match(s, "[-_]$").Success; Console.WriteLine(match ? 200 : 400); } }