Kumetsa

Untitled

Apr 2nd, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import re
  2.  
  3. pattern = r"\|(?P<boss>[A-Z]{4,})\|:#(?P<title>[A-Za-z]+\s[A-Za-z]+)#"
  4.  
  5. n = int(input())
  6.  
  7. for _ in range(n):
  8.     boss_title = input()
  9.     matches = list(re.finditer(pattern, boss_title))
  10.     if any(matches):
  11.         for match in matches:
  12.             strength = len(match.group("boss"))
  13.             armor = len(match.group("title"))
  14.             print(f"{match.group('boss')}, The {match.group('title')}")
  15.             print(f">> Strength: {strength}")
  16.             print(f">> Armor: {armor}")
  17.     else:
  18.         print("Access denied!")
Advertisement
Add Comment
Please, Sign In to add comment