Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace Trainegram
- {
- class Program
- {
- static void Main(string[] args)
- {
- string pattern = @"^(\<\[[^a-zA-Z0-9]*\][\.]{1})+([\.]{1}\[[a-zA-Z0-9]*\][\.]{1})*$";
- Regex regex = new Regex(pattern);
- string input = Console.ReadLine();
- while (input != "Traincode!")
- {
- Match train = regex.Match(input);
- if (train.Success)
- {
- Console.WriteLine(train.Value.ToString());
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement