fun readStr () = valOf (TextIO.inputLine TextIO.stdIn) val () = let val s = readStr () val sWithoutCR = String.substring(s, 0, String.size s - 1) val ans = String.implode ( List.rev ( #2 (List.foldl (fn (c, (i, l)) => (i + 1, Char.chr ((Char.ord c - Char.ord #"A" - i) mod 26 + Char.ord #"A") :: l)) (1, []) (String.explode sWithoutCR)) ) ) in print (ans ^ "\n") end