while True: try: x = input() if len(x) > 1: if x[-2] == '1': print(x + "th") else: if x[-1] == '1': print(x + "st") elif x[-1] == '2': print(x + "nd") elif x[-1] == '3': print(x + "rd") else: print(x + "th") else: if x[-1] == '1': print(x + "st") elif x[-1] == '2': print(x + "nd") elif x[-1] == '3': print(x + "rd") else: print(x + "th") except EOFError: break |
Double click to view unformatted code.