HackerRank Python - Validating UID
ABCXYZ company has up to 100 employees.
The company decides to create a unique identification number (UID) for each of its employees.
The company has assigned you the task of validating all the randomly generated UIDs.
- # Enter your code here. Read input from STDIN. Print output to STDOUT
-
- import re
-
- for _ in range(int(input())):
- u = ''.join(sorted(input()))
- try:
- assert re.search(r'[A-Z]{2}', u)
- assert re.search(r'\d\d\d', u)
- assert not re.search(r'[^a-zA-Z0-9]', u)
- assert not re.search(r'(.)\1', u)
- assert len(u) == 10
- except:
- print('Invalid')
- else:
- print('Valid')