G2A Many GEOs
SHARE
TWEET

Message Decrypter 100/100

KMiteva Apr 2nd, 2020 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Text;
  4. namespace Message_Decrypter
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Regex regex = new Regex(@"^(\$|%)([A-Z][a-z]{2,})\1: \[(\d+)\]\|\[(\d+)\]\|\[(\d+)\]\|$");
  11.  
  12.             int count = int.Parse(Console.ReadLine());
  13.  
  14.             for (int i = 0; i < count; i++)
  15.             {
  16.                 string input = Console.ReadLine();
  17.  
  18.                 Match match = regex.Match(input);
  19.  
  20.                 if (match.Length > 0)
  21.                 {
  22.                     string tag = match.Groups[2].Value;
  23.  
  24.                     char first = (char)int.Parse(match.Groups[3].Value);
  25.                     char second = (char)int.Parse(match.Groups[4].Value);
  26.                     char third = (char)int.Parse(match.Groups[5].Value);
  27.  
  28.                     StringBuilder decrypted = new StringBuilder();
  29.  
  30.                     decrypted.Append(first);
  31.                     decrypted.Append(second);
  32.                     decrypted.Append(third);
  33.  
  34.                     Console.WriteLine($"{tag}: {decrypted}");
  35.                 }
  36.                 else
  37.                 {
  38.                     Console.WriteLine("Valid message not found!");
  39.                 }
  40.             }
  41.         }
  42.     }
  43. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top