Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.Linq;
- using System.Text;
- using System.Collections.Generic;
- namespace TheIsleOfMan
- {
- class Program
- {
- static void Main(string[] args)
- {
- string pattern = @"([#$%*&])(?<name>[A-z]+)(\1)\=(?<count>\d+)\!!(?<code>.+)";
- Regex regex = new Regex(pattern);
- while (true)
- {
- string input = Console.ReadLine();
- if (regex.IsMatch(input))
- {
- int len = int.Parse(regex.Match(input).Groups["count"].Value);
- string geoCode = regex.Match(input).Groups["code"].Value;
- string name = regex.Match(input).Groups["name"].Value;
- if(len==geoCode.Length)
- {
- StringBuilder sb = new StringBuilder();
- sb.Append(geoCode);
- for(int i=0;i<len;i++)
- {
- sb[i]+= (char)len;
- }
- Console.WriteLine($"Coordinates found! {name} -> {sb}");
- break;
- }
- Console.WriteLine("Nothing found!");
- }
- else Console.WriteLine("Nothing found!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement