Question: How to count number of occurrences

Let us say that I have an expression, x*y*z^2*w^3 for example and I want to know the number of occurrances of x,y,z and w. 

So far I have tried splitting into a list and using nops, but I run into the problem that the z^2 and any power term seems to only be counted as one element (which makes sense).

I have also tried using the numboccur command but I have the same issue. I guess my question is, how can I convert this expression into "x*y*z*z*w*w*w" so that I can count w^3 as 3 occurances rather than 1? 

Thank you in advance for any suggestions!

Please Wait...