Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
- using System;
- using System.IO;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- namespace CSharp_Shell
- {
- public static class Program
- {
- public static void Main()
- {
- string text = Console.ReadLine();
- string pattern = @"\+359([ -])2(\1)\d{3}(\1)\d{4})\b";
- MatchCollection matches = Regex.Matches(text, pattern);
- List<string> phones = new List<string>();
- foreach(Match match in matches)
- {
- phones.Add(match.ToString());
- }
- Console.Write(string.Join(", ",phones));
- Console.Write("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement