from collections import Counter s=Counter(input()) print(min([s["e"]//2,s["r"],s["t"]]))