[latex] How to put a symbol above another in LaTeX?

How to put a symbol above (on the head of) another? For example, I want to produce something like this in one line.


i.e., a above #.

The effect should be almost the same with $#^a$ except that a is on the top instead of top right of #.

This question is related to latex

The answer is

Use \overset{above}{main} in math mode. In your case, \overset{a}{\#}.

Similar questions with latex tag: