let list_of_string str = let lstr = String.length str in let rec list_of_string' idx result = if idx >= lstr then result else list_of_string' (idx + 1) (str.[idx] :: result) in list_of_string' 0 [] let solve s = let c_lst = list_of_string s in let t_cnt = List.filter (fun c -> c = 't') c_lst |> List.length and r_cnt = List.filter (fun c -> c = 'r') c_lst |> List.length and e_cnt = List.filter (fun c -> c = 'e') c_lst |> List.length in min t_cnt (min r_cnt (e_cnt / 2)) let () = let s = read_line () in solve s |> string_of_int |> print_endline