Velocity of the body at height h, `v_h=sqrt(2g(H-h))`, horizontally (from the figure given in the problem). Time taken in falling through the distance h.
`t=sqrt((2h)/(g))` (as initial vertical component of the velocity is zero.)
Now `s=v_ht=sqrt(2g(H+h))xxsqrt((2h)/(g))=sqrt(4(Hh-h^2))`
For `s_(max)`, `(d)/(ds)(Hh-h^2)=0`, which yields `h=H/2`
Putting this value of h in the expression obtained for s, we get,
`s_(max)=H`