solve xs = foldr min 999 [t,r,e] where t = length $ filter (=='t') xs r = length $ filter (=='r') xs e = flip div 2 $ length $ filter (=='e') xs main = getLine >>= print . solve