#!/usr/bin/env python # please submit complaints about this code to /dev/null from sys import argv,stdout out = "" newchar = False for char in argv[1]: if char == "*": out += "." continue if char == "1": newchar = True continue if char == "2": l = "abc" if char == "3": l = "def" if char == "4": l = "ghi" if char == "5": l = "jkl" if char == "6": l = "mno" if char == "7": l = "pqrs" if char == "8": l = "tuv" if char == "9": l = "wxyz" if not out or newchar or out[-1] not in l: out += l[0] else: try: out = out[:-1] + l[l.index(out[-1])+1] except IndexError: out = out[:-1] + l[0] newchar = False continue stdout.write(out) stdout.flush()