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