from collections import Counter S=input() C=Counter(S) ANS=1<<60 ANS=min(ANS,C["t"]) ANS=min(ANS,C["r"]) ANS=min(ANS,C["e"]//2) print(ANS)