solve xs = minimum [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