m = {'t': 0, 'r': 1, 'e': 2} c = [0] * 3 for i in input(): if i not in m: continue c[m[i]] += 1 c[2] //= 2 print(min(c))