Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = r"\|(?P<boss>[A-Z]{4,})\|:#(?P<title>[A-Za-z]+\s[A-Za-z]+)#"
- n = int(input())
- for _ in range(n):
- boss_title = input()
- matches = list(re.finditer(pattern, boss_title))
- if any(matches):
- for match in matches:
- strength = len(match.group("boss"))
- armor = len(match.group("title"))
- print(f"{match.group('boss')}, The {match.group('title')}")
- print(f">> Strength: {strength}")
- print(f">> Armor: {armor}")
- else:
- print("Access denied!")
Advertisement
Add Comment
Please, Sign In to add comment