Estimate of analytic function in a unit disk

Suppose $f$ is analytic on an neighborhood of the closed unit disk and $|f| \le a$ on the upper unit semicircle, $|f| \le b$ on the lower unit semicircle. Show that $|f(0)| \le \sqrt{ab}$.

My idea: By Cauchy's integral formula, $\int_{|z|=1} \frac{f(z)}{z} dz = 2\pi i f(0)$. Write $z = e^{i\theta}$, we also have $$\Big\lvert\int_{|z|=1} \frac{f(z)}{z}\, dz \Big\rvert = \Big\lvert i \int_{\theta = 0}^{2\pi} f(e^{i\theta})\, d\theta\Big\rvert \le \pi (a + b)$$ so $|f(0)| \le \frac{a + b}{2}$.

But here we want a better estimate $\sqrt{ab}$. Any hint?

Let $g(z) = f(z)f(-z)$. Then $|g(z)| \le ab$ on the circle (why?). Hence, the maximum modulus principle gives $|g(0)| \le ab$.