\(-x^3+9x^2-27x+27=\left(3-x\right)^3\)
\(-x^3+9x^2-27x+27\)
\(=-x^3+3x^2+6x^2-18x-9x+27\)
\(=-x^2\left(x-3\right)+6x\left(x-3\right)-9\left(x-3\right)\)
\(=-\left(x-3\right)\left(x^2-6x+9\right)\)
\(=-\left(x-3\right)\left(x-3\right)^2\)
\(=\left(3-x\right)^3\)