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.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace RegexFullName
- {
- class Program
- {
- static void Main()
- {
- Regex pattern = new Regex(@"\b[A-Z][a-z]+\b \b[A-Z][a-z]+\b"); // Corrected pattern
- string name = Console.ReadLine();
- MatchCollection matches = pattern.Matches(name);
- foreach (Match m in matches)
- {
- Console.Write(m.Groups[0] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement