# -*- coding: utf-8 -*- from collections import Counter S = Counter(raw_input()) t = S['t'] r = S['r'] e = S['e'] print min(t, r, e // 2)