Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Numerics;
- using System.Text;
- namespace _03.Regexmon
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- var bojoRegex = new Regex(@"[A-Za-z]+-[A-Za-z]+");
- var didiRegex = new Regex(@"[^-A-Za-z]+");
- var count = 0;
- while (input != string.Empty)
- {
- if (count % 2 == 0)
- {
- if (didiRegex.IsMatch(input))
- {
- var match = didiRegex.Match(input);
- Console.WriteLine(match);
- input = didiRegex.Replace(input, string.Empty);
- }
- else
- {
- break;
- }
- }
- else
- {
- if (bojoRegex.IsMatch(input))
- {
- var match = bojoRegex.Match(input);
- Console.WriteLine(match);
- input = bojoRegex.Replace(input, string.Empty);
- }
- else
- {
- break;
- }
- }
- count++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement