Characteristic not implies fully invariant in odd-order class two p-group

Statement
For any (odd) prime $$p$$, there exists a $$p$$-group $$G$$ of class two and a characteristic subgroup of this group that is not fully invariant.

The construction also works for $$p = 2$$, but for $$p = 2$$, there are already examples of abelian groups with characteristic subgroups that are not fully invariant.

Related facts

 * Characteristic not implies fully invariant in finite abelian group
 * Characteristic equals fully invariant in odd-order abelian group
 * Characteristic not implies fully invariant in class three maximal class p-group
 * Center not is fully invariant in class two p-group
 * Socle not is fully invariant in class two p-group

Proof
Let $$p$$ be an odd prime. Let $$P$$ be any non-abelian group of order $$p^3$$ with center $$Z$$. There are two possibilities for $$P$$: a group of prime-square exponent, and a group of prime exponent. In both such groups, there is an element $$x$$ of order $$p$$ outside $$Z$$.

Define $$G = P \times C$$ where $$C$$ is the cyclic group of order $$p$$ with generator $$y$$. The center of $$G$$ is the subgroup $$H = Z \times C$$. Then:


 * $$H$$ is characteristic in $$G$$, because center is characteristic.
 * $$H$$ is not fully invariant in $$G$$: Consider the retraction with kernel $$P \times \{ e \}$$ and with image generated by the element $$(x,y)$$. This is an endomorphism of $$G$$, but it does not send $$H$$ to itself, since the element $$(e,y)$$ gets sent to $$(x,y)$$, which is outside $$H$$.