inp = input() tc = inp.count("t") rc = inp.count("r") ec = inp.count("e") if 0 in [tc, rc, ec]: print(0) elif ec == 1: print(0) else: print(int(min([tc, rc, ec/2])))