Advertisement
viligen

santas_secret_helper

Nov 29th, 2021
1,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import re
  2.  
  3. key = int(input())
  4. pattern = r"@([A-Za-z]+)[^\@\-!:>]*!(G|N)!"
  5.  
  6. while True:
  7.     data = input()
  8.     if data == "end":
  9.         break
  10.     text = ''.join([chr(ord(s)-key) for s in data])
  11.  
  12.     match = re.search(pattern, text)
  13.     if match:
  14.         name = match.group(1)
  15.         behaviour = match.group(2)
  16.         if behaviour == "G":
  17.             print(name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement