# conding: utf-8
import base64
import sys

def decodestr(s):
    dns = s[5:].replace(s[-12:-4],'') + '=='
    return str(base64.b64decode(dns.encode('utf-8')),'utf-8')

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("usage: word_generater.py [decodestr]/[encodestr] [string]")
    if sys.argv[1] == "decode" :
        print(decodestr(sys.argv[2]))
    if sys.argv[1] == "encode" :
        print(encodestr(sys.argv[2]))
