S = input() strt = 0 strr = 0 stre = 0 for i in range(len(S)): if S[i] == "t": strt += 1 if S[i] == "r": strr += 1 if S[i] == "e": stre += 1 count = 0 while strt >= 1 and stre >= 1 and stre >= 2: count += 1 strt -= 1 strr -= 1 stre -= 2 print(count)