Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- regex = r"\!([A-Z][a-z]+)\!:\[(([A-Z]+|[a-z]+)+)\]"
- n = int(input())
- for _ in range(n):
- exp = re.match(regex, input())
- if exp:
- cmd = exp.group(1)
- message = exp.group(2)
- if len(message) >= 8:
- encryption = [str(ord(c)) for c in message]
- print(cmd + ": " + " ".join(encryption))
- else:
- print("The message is invalid")
- else:
- print("The message is invalid")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement