S = gets.rstrip ans = [S.count("t"), S.count("r"), S.count("e") / 2].min puts ans