bl00dt3ars

2

Aug 18th, 2021 (edited)
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import re
  2.  
  3. pattern = r'^\|(?P<name>[A-Z]{4,})\|:#(?P<title>[a-zA-Z]+ [a-zA-Z]+)#$'
  4. n = int(input())
  5.  
  6. for _ in range(n):
  7.     text = input()
  8.     matches = list(re.finditer(pattern, text))
  9.     if len(matches) > 0:
  10.         for match in matches:
  11.             print(f'{match.group("name")}, The {match.group("title")}\n>> Strength: {len(match.group("name"))}\n>> Armor: {len(match.group("title"))}')
  12.     else:
  13.         print('Access denied!')
Add Comment
Please, Sign In to add comment