s = list(*input().split()) print(min(s.count("t"), s.count("r"), s.count("e") // 2))