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.RegularExpressions;
- using System.Text;
- namespace Final_Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- Regex regex = new Regex(@"(\=|\/)(?<name>[A-Z][a-zA-Z]{2,})(\1)");
- MatchCollection match = regex.Matches(input);
- List<string> destination = new List<string>();
- int points = 0;
- foreach (Match item in match)
- {
- if (item.Success)
- {
- string name = item.Groups["name"].Value;
- destination.Add(name);
- points += name.Length;
- }
- }
- Console.WriteLine($"Destinations: {string.Join(", ",destination)}");
- Console.WriteLine($"Travel Points: {points}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement