proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc printf(formatstr: cstring){.header: "", varargs.} proc putchar_unlocked(c:char){.header: "" .} proc printInt(a:int) = # https://stackoverflow.com/questions/18006748/using-putchar-unlocked-for-fast-output if a == 0: putchar_unlocked('0') return var n = a var rev = a var cnt = 0 while rev mod 10 == 0: cnt += 1 rev = rev div 10 rev = 0 while n != 0: rev = (rev shl 3) + (rev shl 1) + n mod 10 n = n div 10 while rev != 0: putchar_unlocked((rev mod 10 + '0'.ord).chr) rev = rev div 10 while cnt != 0: putchar_unlocked('0') cnt -= 1 proc printFloat(a,b:int) = if a == 0: putchar_unlocked('0') elif a mod b == 0: let f = a div b printInt(f) else: let f = a / b let r = a div b printInt(r) putchar_unlocked('.') for i in 0..<5: printInt((a div b) mod 10) putchar_unlocked('\n') var S : array[100002,char] var left = 0 var l = 0 while true: l += 1 let c = getchar_unlocked() S[l] = c if c == 'o' : left += 1 elif c != 'x': break left *= 100 for i in 1..