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}) if tree_count["e"]: e_num = tree_count["e"] tree_count["e"] = int(e_num / 2) print(0 if tree_count["e"] <= 1 else int(min([tree_count["t"],tree_count["r"],tree_count["e"]])))