import strutils, sequtils, algorithm, future, sets var s = stdin.readline c = toSeq 'A'..'Z' for i in 0..s.high: var p = c.find(s[i]) - i - 1 while p < 0: p = c.len + p s[i] = c[p] echo(s)