Is this question still open? If so, could you explain what you mean with ‘it passes custom test case but fails the validator’? Do you mean that you use that in- and output as custom test case and that you pass, but that you fail the validator?
If that is the case, the only issue I see is the formatting (output should be