import tables proc impossible = echo "Impossible" quit() let S = stdin.readLine var dic = initCountTable[char]() for s in S: dic.inc s if dic.largest.val >= 3: impossible() for k, v in dic: if k notin ('a' .. 'm'): impossible() for s in ('a' .. 'm'): var dic2 = dic dic2.inc s if dic2.len >= 13: echo s