Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import re
  2.  
  3. count = int(input())
  4.  
  5. pattern = r"(.+)>([0-9]{3})\|([a-z]{3})\|([A-Z]{3})\|([^<>]{3})<(.+)"
  6.  
  7. for i in range(count):
  8.     password = input()
  9.     x = re.search(pattern, password)
  10.     matches = re.finditer(pattern, password)
  11.     start = ''
  12.     end = ''
  13.     valid_password = ''
  14.     for match in matches:
  15.         start = match[1]
  16.         end = match[6]
  17.         valid_password = match[2] + match[3] + match[4] + match[5]
  18.  
  19.     if x and start == end:
  20.         print(f'Password: {valid_password}')
  21.  
  22.     else:
  23.         print('Try another password!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement