Advertisement
silvana1303

boss rush

Aug 6th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text.RegularExpressions;
  5. using System.Runtime.InteropServices;
  6. using System.Data;
  7. using System.IO;
  8. using System.Reflection.PortableExecutable;
  9.  
  10. namespace _02._Boss_Rush
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             Regex regex = new Regex(@"\|(?<boss>[A-Z]+)\|:#(?<title>[a-zA-Z]+\s[a-zA-Z]+)#");
  17.  
  18.             int times = int.Parse(Console.ReadLine());
  19.  
  20.             for (int i = 0; i < times; i++)
  21.             {
  22.                 string input = Console.ReadLine();
  23.  
  24.                 Match match = regex.Match(input);
  25.  
  26.                 if (match.Success)
  27.                 {
  28.                     string boss = match.Groups["boss"].Value;
  29.                     string title = match.Groups["title"].Value;
  30.                     Console.WriteLine($"{boss}, The {title}");
  31.                     Console.WriteLine($">> Strength: {boss.Length}");
  32.                     Console.WriteLine($">> Armour: {title.Length}");
  33.                 }
  34.                 else
  35.                 {
  36.                     Console.WriteLine("Access denied!");
  37.                 }
  38.             }
  39.          
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement