s = input() t,r,e = [s.count(c) for c in 'tre'] print(min(t, r, e // 2))