s = input() cnt = {'e':0, 'r':0, 't':0} for c in s: if c in cnt: cnt[c] += 1 res = min(cnt['e'] // 2, cnt['r'], cnt['t']) print(res)