Advertisement
svetlyoek

Untitled

Apr 12th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleApp52
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int key = int.Parse(Console.ReadLine());
  12. string text = string.Empty;
  13. StringBuilder decryptedText = new StringBuilder();
  14. while ((text = Console.ReadLine()) != "end")
  15. {
  16. for (int i = 0; i < text.Length; i++)
  17. {
  18. decryptedText.Append((char)((int)text[i] - key));
  19. }
  20. }
  21. string pattern = @"(?<name>(?<=@)[A-Za-z]+)[^@\-!:>]*.(?<behaviour>(?<=!)[G](?=!))";
  22. MatchCollection names = Regex.Matches(decryptedText.ToString(), pattern);
  23. foreach(Match name in names)
  24. {
  25. string validName = name.Groups["name"].Value;
  26. Console.WriteLine($"{validName}");
  27. }
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement