s=input() t,r,e=[s.count(x) for x in "tre"] print(min(t,r,e//2))