Think about this logically. When doing this in your head, you 'concatenate' (join) the CT,CA,PA together and then check through this string with each element (CT,CA) of the other; drawing the appropriate conclusions.
Use the INSTR function to find the commas and then 2 characters left and 2...