s=input() t=s.count('t') r=s.count('r') e=s.count('e') print(min(t,r,e//2))