countTrees :: String -> Int countTrees s = minimum [count 't', count 'r', flip div 2 $ count 'e'] where count c = length $ filter (== c) s main :: IO () main = print . countTrees =<< getLine