Solution (source code)

= Solution

Only strings $k$ in the image of $f$ can be observed. Choose one preimage $x_k$ of an observed string. Under the nonzero-period promise its two preimages are $x_k$ and $x_k+s$. The <Born rule> gives probability $2/2^n$ to this second-register outcome, and conditional normalization leaves the first-register <coset state>
$$
\boxed{|\psi_k\rangle=\frac{|x_k\rangle+|x_k+s\rangle}{\sqrt2}.}
$$
The relative plus sign is retained: measuring the output register reveals which fibre was sampled but does not reveal which member of the fibre was present. Measuring its bits successively gives the same projection onto the observed full string as measuring the whole register at once.