Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         string pattern = @"^(\<\[[^A-Za-z0-9]*\][\.]{1})+([\.]{1}\[[A-Za-z0-9]*\][\.]{1})*$";
  8.  
  9.         string inputLine = Console.ReadLine();
  10.  
  11.         while (inputLine != "Traincode!")
  12.         {
  13.             Match train = Regex.Match(inputLine,pattern);
  14.  
  15.             if (train.Success)
  16.             {
  17.                 Console.WriteLine(inputLine);
  18.             }
  19.             inputLine = Console.ReadLine();
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement