import sequtils,algorithm,strutils template times*(n:int,body) = (for _ in 0.." .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc printf(formatstr: cstring){.header: "", varargs.} proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "" .} var preAlphabets : array[1_00010,char] var preNums : array[1_00010,char] template printNums(n:int) = for i in 0.. 0: S &= ('0'.ord + ch).chr for i in (S.len-1).countdown(0): putchar_unlocked(S[i]) proc impl() = var preAlphabetsLen = 0 var preNumsLen = 0 var isNum = false while true: let k = getchar_unlocked() if k.ord < 32 or k.ord > 126 : if isNum: if preAlphabetsLen > 0 : printAlphabets(preAlphabetsLen) printAdd1(preNumsLen) else: if preNumsLen > 0: printAdd1(preNumsLen) printAlphabets(preAlphabetsLen) putchar_unlocked('\n') return let kIsNum = k >= '0' and k <= '9' if kIsNum and not isNum: if preNums.len > 0: printNums(preNumsLen) preNumsLen = 0 printAlphabets(preAlphabetsLen) preAlphabetsLen = 0 if kIsNum: preNums[preNumsLen] = k preNumsLen += 1 else: preAlphabets[preAlphabetsLen] = k preAlphabetsLen += 1 isNum = kIsNum scan().times: impl()