ratsimp and many terms to collect. 3 lines.



you can try something like....

matchdeclare([a,b,c,d],true);
tellsimp(Power(a,b)*Power(c,b)*d,  d* Power(a*c,b));
change(z):= subst("^",Power, subst(Power,"^", z));

change(x^a*x^b*z^r)   for example.