If $f$ is a non-constant analytic function on $B$ such that $|f|$ is a constant on $\partial B$, then $f$ must have a zero in $B$ [duplicate]

The question goes like this:

Let $B=\{z\in C: |z|<R\}$ and $\partial B$ is the circle of radiu $R$. If $f$ is a non-constant analytic function on $B$ such that $|f|$ is a constant on $\partial B$, then $f$ must have a zero in $B$

My attempt:

From the assumption that $f$ is a non-constant analytic function on $B$, we have the maximum of $|f|$ is achieved on $\partial B$. Then I got stucked... I believe that since $\partial B$ is constant, and $f$ is a non-constant, the value of $|f|$ must variate in the interior of $B$ so there is a zero. But how to prove it mathematically?


Hint:If $f$ does not have a zero, apply max modulus principle on $f$ and $\frac {1}{f}$ respectively to conclude $f$ is constant.


If $f$ has no zero in $B$, then $1/f$ is analytic in $B$ and achieve its maximum on $\partial B$, which means that $f$ has same maximum and minimum because $|f|$ is a constant on $\partial B$. This means $f$ is constant in $B$, contradiction.