Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- count = int(input())
- pattern = r"(.+)>([0-9]{3})\|([a-z]{3})\|([A-Z]{3})\|([^<>]{3})<(.+)"
- for i in range(count):
- password = input()
- x = re.search(pattern, password)
- matches = re.finditer(pattern, password)
- start = ''
- end = ''
- valid_password = ''
- for match in matches:
- start = match[1]
- end = match[6]
- valid_password = match[2] + match[3] + match[4] + match[5]
- if x and start == end:
- print(f'Password: {valid_password}')
- else:
- print('Try another password!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement