def larger(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 == 't': t += 1 elif s == 'r': r += 1 elif s == 'e': e += 1 print larger(larger(t, r), e/2)