import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import Counter S = read().rstrip().decode() counter = Counter(S) t,r,e = [counter[x] for x in 'tre'] ee = e // 2 answer = min(t,r,ee) print(answer)