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.RegularExpressions;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex regex = new Regex(@"(\*|\@)(?<tag>[A-Z][a-z]{2,})(\1): \[(?<first>[A-Z]|[a-z])\]\|\[(?<second>[A-Z]|[a-z])\]\|\[(?<third>[A-Z]|[a-z])\]\|$");
- int count = int.Parse(Console.ReadLine());
- for (int i = 0; i < count; i++)
- {
- string input = Console.ReadLine();
- Match match = regex.Match(input);
- if (match.Success)
- {
- string tag = match.Groups["tag"].Value;
- char first = char.Parse(match.Groups["first"].Value);
- char second = char.Parse(match.Groups["second"].Value);
- char third = char.Parse(match.Groups["third"].Value);
- Console.WriteLine($"{tag}: {(int)first} {(int)second} {(int)third}");
- }
- else
- {
- Console.WriteLine("Valid message not found!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement