GroZnik81

2ra_2012

Dec 20th, 2020
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2.  
  3. number_of_inputs = int(input())
  4.  
  5. pattern = r'|(?P<boss>[A-Z]{4,})|:#(?P<title>[A-Za-z]+\s[A-Za-z]+)#'
  6.  
  7. for b in range(number_of_inputs):
  8.     boss_data = input()
  9.     strength = 0
  10.     armour = 0
  11.     if re.match(pattern, boss_data):
  12.         match = re.finditer(pattern, boss_data)
  13.         for m in match:
  14.             strength = len(m.group('boss'))
  15.             armour = len(m.group('title'))
  16.             print(f"{m.group('boss')}, {m.group('title')}")
  17.             print(f">>Strength: {strength}")
  18.             print(f">>Armour: {armour}")
  19.     else:
  20.         print("Access denied!")
RAW Paste Data