How can I define a command like *, similar to
\newcommand{\astcommand}[1]{{#1}^*}
but which, when applied to a single symbol a, gives the output a*, and when applied to multiple symbols, like abc, automatically adds brackets to the output, like (abc)*?
I mean, without having to call it with brackets, as in
\astcommand{(abc)}
just
\astcommand{abc}