t,r,e = map(input().count, 'tre') print(min(t,r,e//2))