#!/usr/bin/python # -*- coding: utf-8 -*- S = raw_input() ans = [ S.count("t") , S.count("r") , S.count("e") / 2 ] print min(ans)