Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Numerics;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace apps
- {
- class Program
- {
- static string Get() { return Console.ReadLine(); }
- static void Main()
- {
- // santa helper
- int key = int.Parse(Get());
- //---------------------------------------
- string pattern = @"\@(?<name>[a-zA-Z]+)[\d\D]*(?<behavior>\!G\!)";
- //---------------------------------------
- List<string> allMatches = new List<string>(); // list for each line
- while (true)
- {
- string command = Get(); if (command == "end") { break; }
- char[] message = command.ToCharArray();
- string newstring = string.Empty;
- for (int i = 0; i < message.Length; i++){ newstring += (char)((int)message[i] - key); ;}
- allMatches.Add(newstring); //add to list
- }
- for (int i = 0; i < allMatches.Count; i++)
- {
- Match m = Regex.Match(allMatches[i], pattern);
- if (m.Success)
- {
- string name = m.Groups["name"].Value;
- Console.WriteLine(name);
- }
- }
- }// END MAIN
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment