S = input() tc = S.count("t") rc = S.count("r") ec = S.count("e") // 2 print(min([tc,rc,ec]))