Solution (source code)

= Solution

A horizontal <Stern-Gerlach spin measurement> measures $S_x$. The inputs are its orthogonal <eigenstates>, so
$$
\boxed{p(x+|\psi_+)=1,\quad p(x+|\psi_-)=0.}
$$
The output beam identifies the input with certainty in a single ideal measurement.