s=raw_input() t="tree" print min(map(lambda x:s.count(x)/t.count(x),t))