character(len=1000000)::str integer::t,r,e,i data t,r,e/0,0,0/ read *, str do i = 1, LEN_TRIM(str) select case(str(i:i)) case('t') t = t + 1 case('r') r = r + 1 case('e') e = e + 1 end select end do print '(i0)', MINVAL((/t,r,e/2/)) end program