#coding:utf-8 s=raw_input() t=s.count('t') r=s.count('r') e=s.count('e')/2 ans=0 while t and r and e: t-=1 r-=1 e-=1 ans+=1 print ans