Swap the first characters
if ( p [ 0 ] != q [ 0 ] ) : NEW_LINE INDENT p = list ( p ) NEW_LINE q = list ( q ) NEW_LINE temp = p [ 0 ] NEW_LINE p [ 0 ] = q [ 0 ] NEW_LINE q [ 0 ] = temp NEW_LINE p = ' ' . join ( p ) NEW_LINE q = ' ' . join ( q ) NEW_LINE flag1 = 0 NEW_LINE flag2 = 0 NEW_LINE DEDENT