How do I factor non-traditional math problems that contain symbols? The examples given were: $q + $8 - $~ and 7* - x* + 2*.

I'd say

$(q+8-~) and *(7-x+2)

non-traditional, to be sure, not to say non-useful