S = raw_input() t = S.count('t') r = S.count('r') e = S.count('e') ans = min(min(t,r),e / 2) print ans