Change code so that S1!=S2