Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _01.Trainegram
- {
- public class StartUp
- {
- public static void Main()
- {
- string pattern = @"^(<\[[^A-Za-z0-9\n]*]\.)(\.\[[A-Za-z0-9]*]\.)*$";
- Regex regex = new Regex(pattern);
- while (true)
- {
- string train = Console.ReadLine();
- if (train == "Traincode!")
- {
- break;
- }
- Match match = regex.Match(train);
- if (match.Success)
- {
- Console.WriteLine(match.ToString());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment