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;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace _1.Match_Full_Name
- {
- class Program
- {
- static void Main(string[] args)
- {
- string regex = @"(\b[A-Z][a-z]{1,}\b {1}\b[A-Z][a-z]+\b)";
- string names = Console.ReadLine();
- MatchCollection matchedNames = Regex.Matches(names, regex);
- var result = new List<string>();
- foreach (Match name in matchedNames)
- {
- result.Add(name.Value);
- }
- foreach (var item in result.Distinct())
- {
- Console.Write(item + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement