  The free semigroup $\mathcal{F}$ over a finite alphabet $\mathcal{A}$ is the
set of all finite words with letters from $\mathcal{A}$ equipped with the
operation of concatenation. A subset $S$ of $\mathcal{F}$ is $k$-product-free
if no element of $S$ can be obtained by concatenating $k$ words from $S$, and
strongly $k$-product-free if no element of $S$ is a (non-trivial) concatenation
of at most $k$ words from $S$.
  We prove that a $k$-product-free subset of $\mathcal{F}$ has upper Banach
density at most $1/\rho(k)$, where $\rho(k) = \min\{\ell \colon \ell \nmid k -
1\}$. We also determine the structure of the extremal $k$-product-free subsets
for all $k \notin \{3, 5, 7, 13\}$; a special case of this proves a conjecture
of Leader, Letzter, Narayanan, and Walters. We further determine the structure
of all strongly $k$-product-free sets with maximum density. Finally, we prove
that $k$-product-free subsets of the free group have upper Banach density at
most $1/\rho(k)$, which confirms a conjecture of Ortega, Ru\'{e}, and Serra.
