Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApp1
- {
- using System;
- using System.Text.RegularExpressions;
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- Regex regD = new Regex(@"[^a-zA-Z-]+");
- Regex regB = new Regex(@"[a-zA-Z]+-[a-zA-Z]+");
- int indexD = 0;
- int indexB = 0;
- while (true)
- {
- Match didimon = regD.Match(input, indexD);
- if (!didimon.Success) break;
- Console.WriteLine(didimon.Value);
- indexB = didimon.Index + didimon.Value.Length;
- Match bojomon = regB.Match(input, indexB);
- if (!bojomon.Success) break;
- Console.WriteLine(bojomon.Value);
- indexD = bojomon.Index + bojomon.Value.Length;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement