val dic = ('A'..'Z').toList() val n = dic.size fun main(args: Array) { val S = readLine()?.toMutableList() ?: return S.forEachIndexed { i, v -> S[i] = dic[((v - 'A' - i - 1) % n + n) % n] } println(S.joinToString("")) }