s=input() t=s.count("t") r=s.count("r") e=s.count("e")//2 print(min(t,r,e))