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.Runtime.InteropServices;
- using System.Data;
- using System.IO;
- using System.Reflection.PortableExecutable;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex regex = new Regex(@"!(?<command>[A-Z][a-z]{2,})!:\[(?<message>[a-zA-Z]{8,})\]");
- int times = int.Parse(Console.ReadLine());
- List<int> output1 = new List<int>();
- for (int i = 0; i < times; i++)
- {
- string input = Console.ReadLine();
- Match match = regex.Match(input);
- if (match.Success)
- {
- string command = match.Groups["command"].Value;
- string message = match.Groups["message"].Value;
- char[] chars = message.ToCharArray();
- foreach (var item in chars)
- {
- int j = item;
- output1.Add(j);
- }
- Console.WriteLine($"{command}: {string.Join(" ", output1)}");
- }
- else
- {
- Console.WriteLine("The message is invalid");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement