s = input() t = s.count("t") r = s.count("r") e = s.count("e") print(f'{min(t, r, e/2):.0f}')