S = input() tree = "tree" d = {} for s in S: if s not in d: d[s] = 0 d[s] += 1 for s in tree: if s not in d: d[s] = 0 print(min(d['t'], d['r'], int(d['e']/2)))