d={'t':0,'r':0,'e':0} for i in input(): if i in d: d[i]+=1 d['e']//=2 print(min(d.values()))