l = list(input()) t = l.count("t") r = l.count("r") e = l.count("e") print(min((t,r,e//2)))