\documentclass[uplatex]{article}
\usepackage{hideanswer}
\begin{document}
\sethideanswer
\unsethideanswer

A\hideanswer{B}A

C\hideanswer*{D}C

E%
\begin{hideanswerdiv}
$$F$$
\end{hideanswerdiv}%
E

G%
\begin{hideanswerdiv*}
$$H$$
\end{hideanswerdiv*}%
G

I\smashanswer{J}I

K\smashanswer*{L}K

M%
\begin{smashanswerdiv}
$$N$$
\end{smashanswerdiv}%
M

O%
\begin{smashanswerdiv*}
$$P$$
\end{smashanswerdiv*}%
O
\end{document}