import tables var s = stdin.readLine dic = initCountTable[char]() for ch in s: dic.inc(ch) echo min(dic['t'], dic['r'], dic['e'] div 2)