The right most derivation of the string xxxxyzz is:
S-> xxW -> xxSz --> xxxxWz ---> xxxxSzz --> xxxxyzz
A shift reduce parser, performs the right most derivation in reverse. So first it reduces the y to 5, by the production S --> Y . As a consequence of this, b is immediately printed. Next, Sz is reduced to W and so on. So the answer is bcaca.