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