We could answer this step by step:
Step 1: All X's in the last four letters. (YYYY, ZZZZ, XXXX): (4!/4!)³ = 1 combination
Step 2: 3X's in the last 4 letters and 1 X in the second 4 letters. Then any word we make will be a permutation of YYYZ XZZZ XXXY, where we permute only within the blocks of four letters. There are (4!/3!)³ = 64 possible combinations.
Step 3: 2X's in the last 4 letters and 2 X's in the second 4 letters. Then the possible combination would be YYZZ XXZZ XXYY, where we permute only within the blocks of four letters.
There are (4!/2!2!)³ = 216 combinations
Step 4: 1 X in the last 4 letters and 3 X's in the second 4 letters. Just like in the Step 2, there will be 64 possible combinations. (YZZZ XXXZ YYYX): (4!/3!)³ = 64
Step 5: All 4 X's in the second 4 letters. Just like in Step 1, there is only one possible combination which is (ZZZZ XXXX YYYY): (4!/4!)³ = 1
Totaling each step will give us: 1 + 64 + 216 + 64 + 1 = 346 words.