Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- n = int(input())
- for _ in range(n):
- found = False
- text = input()
- part_1, part_2, part_3, part_4 = '', '', '', ''
- regex = r'^(.+)>(?P<numbers>[0-9]{3})\|(?P<lower>[a-z]{3})\|(?P<upper>[A-Z]{3})\|(?P<rest>[^<>]{3})<\1$'
- match = re.search(regex, text)
- if match:
- part_1 = match.group('numbers')
- part_2 = match.group('lower')
- part_3 = match.group('upper')
- part_4 = match.group('rest')
- if part_1 and part_2 and part_3 and part_4:
- found = True
- if found:
- password = f'{part_1}{part_2}{part_3}{part_4}'
- print(f'Password: {password}')
- else:
- print('Try another password!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement