Advertisement
YavorGrancharov

Snowflake(ExamTask03)05.01.18

Jan 5th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace Snowflake
  5. {
  6.     class MainClass
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             string surface = @"^([^a-zA-Z0-9]+)$";
  11.             string mantle = @"^([0-9_]+)$";
  12.             string core = @"^([^\w]+)([\d_]+)([a-zA-Z]+)([\d_]+)([^\w]+)$";
  13.  
  14.             for (int i = 0; i < 1; i++)
  15.             {
  16.                 string validSurface = Console.ReadLine();
  17.                 string validMantle = Console.ReadLine();
  18.                 string validCore = Console.ReadLine();
  19.                 string validMantleDup = Console.ReadLine();
  20.                 string validSurfaceDup = Console.ReadLine();
  21.  
  22.                 if (Regex.IsMatch(validSurface, surface) && Regex.IsMatch(validMantle, mantle)
  23.                     && Regex.IsMatch(validCore, core) && Regex.IsMatch(validMantleDup, mantle)
  24.                     && Regex.IsMatch(validSurfaceDup, surface))
  25.                 {
  26.                     Console.WriteLine("Valid");
  27.                     string coreLen = Regex.Match(validCore, core).Groups[3].Value;
  28.                     Console.WriteLine(coreLen.Length);
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.WriteLine("Invalid");
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement