Advertisement
obedmarsh

03. Trainegram

Aug 28th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace ExamSecondPreparation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<string> l = new List<string>();
  14.             string pattern = @"(^<\[[^a-zA-Z0-9]*\]\.(\.\[[a-zA-Z0-9]*\]\.)*)$";
  15.             string text = Console.ReadLine();
  16.             while (text != "Traincode!")
  17.             {
  18.                 if (Regex.IsMatch(text, pattern))
  19.                 {
  20.                     l.Add(text);
  21.                 }
  22.                 text = Console.ReadLine();
  23.             }
  24.             foreach (var item in l)
  25.             {
  26.                 Console.WriteLine(item);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement