main = getLine >>= print . tree tree s = minimum [numOf 't', numOf 'r', div (numOf 'e') 2] where numOf c = length (filter (==c) s)