s=raw_input(); n=[s.count(c) for c in "tre"]; n[2]/=2; print min(n)