n=input() ct=n.count("t") cr=n.count("r") ce=n.count("e") print(min(ct,cr,ce//2))