from collections import Counter S = input() count = Counter(S) tree_count = dict() for k,v in count.items(): if k in ["t","r","e"]: tree_count.update({k:v}) e_num = int((tree_count["e"] if tree_count["e"] else 0)/2) print(0 if e_num < 1 else int(min([tree_count["t"],tree_count["r"],e_num])))