Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- string input = string.Empty;
- string pattern = @"^([A-Za-z0-9\!\@\#\$\?]+)=(\d+)<<([A-Za-z0-9]+)$";
- while ((input = Console.ReadLine()) != "Last note")
- {
- Match match = Regex.Match(input, pattern);
- if (match.Success)
- {
- string name = match.Groups[1].Value;
- int lenght = int.Parse(match.Groups[2].Value);
- string geohasCode = match.Groups[3].Value;
- if (lenght == geohasCode.Length)
- {
- var nameOfMountain = new String(name.Where(Char.IsLetterOrDigit).ToArray());
- Console.WriteLine($"Coordinates found! {nameOfMountain} -> {geohasCode}");
- }
- else
- {
- Console.WriteLine("Nothing found!");
- }
- }
- else
- {
- Console.WriteLine("Nothing found!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement