import sys input=lambda: sys.stdin.readline().rstrip() S=input() t,r,e=S.count("t"),S.count("r"),S.count("e") print(min(t,r,e//2))