Let L(S) be a length of an expression S.
Each sentence symbol x is a well-formed formula of L(x)=1.
For a wff a, .
For wff a,b, .
Now, we have wff's of length 1, 4, and 5. You can check the remaining cases inductively and make sure that no wff's of length 2,3 or 6 is possible.