Measurement of the helicity of W bosons in top-quark decays