diff --git a/googlerese.py b/googlerese.py new file mode 100755 index 0000000..20dd840 --- /dev/null +++ b/googlerese.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import sys + +#y = a +#h = b +#e = c +#s = d +#o = e +#c = f +#v = g +#x = h +#d = i +#u = j +#i = k +#g = l +#l = m +#b = n +#k = o +#r = p +#z = q +#t = r +#n = s +#w = t +#j = u +#p = v +#f = w +#m = x +#a = y +#q = z + +T = ['y', 'h', 'e', 's', 'o', 'c', 'v', 'x', 'd', 'u', 'i', 'g', 'l', 'b', 'k', + 'r', 'z', 't', 'n', 'w', 'j', 'p', 'f', 'm', 'a', 'q'] + +def translate(A): + r = '' + for i in range(len(A)): + c = ord(A[i]) # get ascii code for A[i] + + if A[i].isupper(): # If the character is an uppercase letter + tmp = T[c - ord('A')] # T[0] for 'A', T[1] for 'B' and so on + r = r + tmp.upper() # Convert back to uppercase + + elif A[i].islower(): # If the character is a lowercase letter + r = r + T[c - ord('a')] # T[0] for 'a', T[1] for 'b' and so on + # Already lowercase, so no conversion needed + + else: # otherwise, just append the character as-is + r = r + A[i] + return r + +if __name__ == "__main__": + count = int(sys.stdin.readline()) + for i in range(count): + A = sys.stdin.readline().rstrip() # Read a line of input stripping the end of + # line character at the end. Needed because print() is going to put a new + # line for us and we don't want two + print('Case #' + str(i + 1) + ": " + translate(A)) diff --git a/googlerese.txt b/googlerese.txt new file mode 100644 index 0000000..0cea751 --- /dev/null +++ b/googlerese.txt @@ -0,0 +1,4 @@ +3 +ejp mysljylc kd kxveddknmc re jsicpdrysi +rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd +de kr kd eoya kw aej tysr re ujdr lkgc jv