S = raw_input() t, r, e = 0, 0, 0 for c in S: if c == 't': t += 1 elif c == 'r': r += 1 elif c == 'e': e += 1 print(min(t, r, e/2))