Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace Orders
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool coordinatesFound = false;
- while (!coordinatesFound)
- {
- string input = Console.ReadLine();
- string lengthPattern = @"=(\d+)!!";
- Match number = Regex.Match(input, lengthPattern);
- if (number.Success)
- {
- int length = int.Parse(number.Groups[1].Value);
- string pattern = $@"([#$%*&])(\w+)\1=(\d+)!!(.{{{length}}})$";
- Match match = Regex.Match(input, pattern);
- if (match.Success)
- {
- coordinatesFound = true;
- string name = match.Groups[2].Value;
- string coord = match.Groups[4].Value;
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < coord.Length; i++)
- {
- sb.Append((char)(coord[i] + coord.Length));
- }
- Console.WriteLine($"Coordinates found! {name} -> {sb}");
- break;
- }
- //Console.WriteLine(length);
- }
- Console.WriteLine("Nothing found!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement