def smaller(x, y): if x < y: return x else: return y s = raw_input() t = 0 r = 0 e = 0 for i in range(0, len(s)): if s[i] == 't': t += 1 elif s[i] == 'r': r += 1 elif s[i] == 'e': e += 1 print smaller(smaller(t, r), e/2)