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