s = input() d = {} for i in s: if not i in d: d[i] = 1 else: d[i] += 1 md = {'e': 2, 't': 1, 'r': 1} print(min(d[i] // md[i] for i in md))