Advertisement
Guest User

03.Trainegram

a guest
Aug 22nd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace _03.Trainegram
  5. {
  6.     class Trainegram
  7.     {
  8.         static void Main()
  9.         {
  10.             Regex pattern = new Regex(@"^(<\[[^A-Za-z0-9]*]\.)(\.\[[A-Za-z0-9]*]\.)*$");
  11.             string input = Console.ReadLine();
  12.  
  13.             while (input != "Traincode!")
  14.             {
  15.                 MatchCollection matches = pattern.Matches(input);
  16.  
  17.                 foreach (Match match in matches)
  18.                 {
  19.                     Console.WriteLine(match.Value);
  20.                 }
  21.                
  22.                 input = Console.ReadLine();
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement