  A function on an algebra is congruence preserving if, for any congruence, it
maps congruent elements to congruent elements. We show that, on a free monoid
generated by at least 3 letters, a function from the free monoid into itself is
congruence preserving %nonmonogenic if and only if it is of the form $x \mapsto
w_0 x w_1 \cdots w_{n-1} x w_n$ for some finite sequence of words
$w_0,\ldots,w_n$. We generalize this result to functions of arbitrary arity.
This shows that a free monoid with at least three generators is a
(noncommutative) affine complete algebra. Up to our knowledge, it is the first
(nontrivial) case of a noncommutative affine complete algebra.
