Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text;
- using System.Text.RegularExpressions;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine();
- Regex pattern = new Regex(@"!([A-Z][a-z]{3,})!:\[([A-Za-z]{8,})\]");
- Match matches = pattern.Match(input);
- if (matches.Success)
- {
- string command = matches.Groups[1].Value;
- string pass = matches.Groups[2].Value;
- Console.Write($"{command}: ");
- for (int r = 0; r < pass.Length; r++)
- {
- int diff = (int)pass[r];
- Console.Write(diff + " ");
- }
- Console.WriteLine();
- }
- else
- {
- Console.WriteLine("The message is invalid");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement