Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _3s
- {
- class izp_3Snow
- {
- static void Main()
- {
- string pattern1 = @"([^a-zA-Z0-9_\s]+)";
- string pattern2 = @"([\d_]+)";
- string pattern3 = @"([^a-zA-Z0-9_\s]+)([\d_]+)([a-zA-Z]+)([\d_]+)([^a-zA-Z0-9_\s]+)";
- //string patternCore = @"([a-zA-Z]+)";
- bool isValid = false;
- string mid = "";
- string l1 = Console.ReadLine();
- string l2 = Console.ReadLine();
- string l3 = Console.ReadLine();
- string l4 = Console.ReadLine();
- string l5 = Console.ReadLine();
- isValid = Regex.IsMatch(l1, pattern1);
- if (isValid == true)
- {
- isValid = Regex.IsMatch(l2, pattern2);
- if (isValid == true)
- {
- isValid = Regex.IsMatch(l3, pattern3);
- if (isValid == true)
- {
- MatchCollection midM = Regex.Matches(l3, pattern3);
- foreach (Match item in midM)
- {
- mid = item.Groups[3].ToString();
- }
- isValid = Regex.IsMatch(l4, pattern2);
- if (isValid == true)
- {
- isValid = Regex.IsMatch(l5, pattern1);
- if (isValid == true)
- {
- Console.WriteLine("Valid");
- Console.WriteLine(mid.Length);
- }
- }
- }
- }
- }
- else if(isValid == false)
- {
- Console.WriteLine("Invalid");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement