fun main(args: Array) { val inText = readLine()!! val arr = inText.map { it - 'A' }.toMutableList() val span = 'Z' - 'A' + 1 for(i in arr.indices) { var newChar = arr[i] - (i+1) while (newChar < 0) { newChar = newChar + span } arr[i] = ('A' + newChar).toInt() } println(arr.map { it.toChar() }.joinToString("")) }