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