diff --git a/encryption.py b/encryption.py new file mode 100644 index 0000000..ea83518 --- /dev/null +++ b/encryption.py @@ -0,0 +1,27 @@ +@@ -0,0 +1,25 @@ +#!/bin/python3 + +import math +import os + +# complete the encryption function below. +def encryption(s): + L = len(s) + rows = int(math.floor(L**(0.5))) + columns = int(math.ceil(L**(0.5))) + output = "" + for i in range(columns): + k = i + for j in range(k,L,columns): + output+=s[j] + output+=" " + return output + + +if __name__ == '__main__': + fptr = open(os.environ['OUTPUT_PATH'], 'w') + s = input() + result = encryption(s) + fptr.write(result + '\n') + fptr.close() +