import json
import os
import boto3
import string
def decrypt(text,s):
result = ""
# transverse the plain text
for i in range(len(text)):
char = text[i]
# Encrypt uppercase characters in plain text
if ([Link]()):
result += chr((ord(char) - s-65) % 26 + 65)
# Encrypt lowercase characters in plain text
else:
result += chr((ord(char) - s-97) % 26 + 97)
return result
def handler(event, context):
## DO NOT EDIT THE SECTION BELOW HERE ##
#Import halfDecoded string
s3 = [Link]('s3')
obj = [Link]([Link]['bucketName'], '[Link]')
inputString = [Link]()['Body'].read().decode('utf-8')
## ADD NEW CODE DIRECTLY BELOW HERE ##
# *Your halfDecoded input string is already stored in 'inputString' variable
# *Store the result string from your code into the 'outputString' variable
#TO BE DONE - Decipher the Caesar Cipher
print('inputString :: ',inputString)
outputString = decrypt(inputString,12)
#TO BE DONE - Transpose all letters 6 left (wrapping around)
slice1 = outputString[0:6]
outputString = [Link](outputString[0:6], '')+outputString[0:6]
## NEW CODE GOES ABOVE HERE ##
## DO NOT EDIT THE SECTION BELOW THIS LINE ##
#Export outputString
try:
f = open("/tmp/[Link]", "x")
[Link]()
f = open("/tmp/[Link]", "a")
[Link](outputString)
[Link]()
except:
f = open("/tmp/[Link]", "w")
[Link](outputString)
[Link]()
s3 = [Link]('s3')
s3.upload_file('/tmp/[Link]', [Link]['bucketName'], '[Link]')
#Return for logs and final answer!
return {
'input' : inputString,
'output': outputString
}