This should be a very simple string parsing problem: check for each of the five pieces.
The only restrictions on the sentences are:
If the sentence really is Quine(A), it follows from the whitespace restrictions that A will not have any leading, trailing, or consecutive whitespace either. However, that really should not matter, as there is no reason to examine the phrase A at all—only to do a string comparison to make sure it is the same both places.