Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace Snowflake_01_18
- {
- class Program
- {
- static void Main(string[] args)
- {
- string surface1 = Console.ReadLine();
- string mantle1 = Console.ReadLine();
- string core = Console.ReadLine();
- string mantle2 = Console.ReadLine();
- string surface2 = Console.ReadLine();
- string patternSurface = @"^[^A-Za-z0-9]+$";
- Match matchSurface1 = Regex.Match(surface1, patternSurface);
- Match matchSurface2 = Regex.Match(surface2, patternSurface);
- if (matchSurface1.Success == false || matchSurface2.Success == false)
- {
- Console.WriteLine("Invalid");
- return;
- }
- string patternMantle = @"^[0-9_]+$";
- Match matchMantle1 = Regex.Match(mantle1, patternMantle);
- Match matchMantle2 = Regex.Match(mantle2, patternMantle);
- if (matchMantle1.Success == false || matchMantle2.Success == false)
- {
- Console.WriteLine("Invalid");
- return;
- }
- string patternCore = @"^([^A-Za-z0-9]+)([0-9_]+)(?<core>[A-Za-z]+)([0-9_]+)([^A-Za-z0-9]+)$";
- Match matchCore = Regex.Match(core, patternCore);
- if (matchCore.Success == false)
- {
- Console.WriteLine("Invalid");
- return;
- }
- string validCore = matchCore.Groups["core"].ToString();
- Console.WriteLine("Valid");
- Console.WriteLine(validCore.Length);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment