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