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;
- using System.Text;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex regex = new Regex(@"^(\$|\%)(?<name>[A-Z][a-z]{2,})(\1): \[(?<first>[0-9]+)\]\|\[(?<second>[0-9]+)\]\|\[(?<third>[0-9]+)\]\|$");
- int times = int.Parse(Console.ReadLine());
- for (int i = 0; i < times; i++)
- {
- string input = Console.ReadLine();
- Match match = regex.Match(input);
- if (match.Success)
- {
- string name = match.Groups["name"].Value;
- int first = int.Parse(match.Groups["first"].Value);
- int second = int.Parse(match.Groups["second"].Value);
- int third = int.Parse(match.Groups["third"].Value);
- int[] array = { first, second, third };
- StringBuilder output = new StringBuilder();
- foreach (var item in array)
- {
- char j = (char)item;
- output.Append(j);
- }
- Console.WriteLine($"{name}: {output}");
- }
- else
- {
- Console.WriteLine("Valid message not found!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement