proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "" .} proc printAscii(a:int) = if a == 0: putchar_unlocked('A') return template div26(a:int) : int = a div 26 template mod26(a:int) : int = a mod 26 var n = a var rev = a var cnt = 0 while rev.mod26 == 0: cnt += 1 rev = rev.div26 rev = 0 while n != 0: rev = rev * 26 + n.mod26 n = n.div26 while rev != 0: putchar_unlocked((rev.mod26 + 'A'.ord).chr) rev = rev.div26 while cnt != 0: putchar_unlocked('A') cnt -= 1 # 0 1 2 3 10 11 12 13 20 21 22 23 # A G H Z BA BB .. scan().printAscii() putchar_unlocked('\n')