Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numOfLine = int.Parse(Console.ReadLine());
- Regex regex = new Regex(@"^\|([A-Z]{4,})\|:#([A-Z]{1}[a-z]+\s[a-z]+)#$");
- for (int i = 0; i < numOfLine; i++)
- {
- string input = Console.ReadLine();
- Match match = regex.Match(input);
- if (match.Success)
- {
- string bossName = match.Groups[1].Value;
- string title = match.Groups[2].Value;
- Console.WriteLine($"{bossName}, The {title}");
- Console.WriteLine($">> Strength: {match.Groups[1].Length}");
- Console.WriteLine($">> Armour: {match.Groups[2].Length}");
- }
- else
- {
- Console.WriteLine("Access denied!");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement