Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _02.Destination_Mapper
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex regex = new Regex(@"([=\/])([A-Z][A-Za-z]{2,})\1");
- string input = Console.ReadLine();
- var matches = regex.Matches(input);
- Console.Write($"Destinations: ");
- int travelPoints = 0;
- int indexOfMatches = 0;
- foreach (Match match in matches)
- {
- indexOfMatches++;
- Console.Write($"{match.Groups[2].Value}");
- travelPoints += match.Groups[2].Value.Length;
- if (indexOfMatches < matches.Count)
- {
- Console.Write(", ");
- }
- }
- Console.WriteLine();
- Console.WriteLine($"Travel Points: {travelPoints}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement