D={'t':0,'r':0,'e':0} for x in input(): if x in 'tree':D[x]+=1 print(min(D['t'],D['r'],D['e']//2))