s = input() t=0 r=0 e=0 for x in s: if x =='t': t+=1 if x == 'r': r+=1 if x == 'e': e+=1 print(min(t,r,e//2))