if ' _ ' can be swapped with the character 'i+2
' NEW_LINE INDENT if pp > 1 and ss [ pp - 1 ] != ss [ pp - 2 ] : NEW_LINE INDENT ss = list ( ss ) NEW_LINE ss [ pp ] , ss [ pp - 2 ] = ss [ pp - 2 ] , ss [ pp ] NEW_LINE ss = ' ' . join ( ss ) NEW_LINE if ss not in vis : NEW_LINE INDENT if ss == f : NEW_LINE INDENT return dist + 1 NEW_LINE DEDENT vis [ ss ] = dist + 1 NEW_LINE q . append ( ( ss , pp - 2 ) ) NEW_LINE DEDENT ss = list ( ss ) NEW_LINE ss [ pp ] , ss [ pp - 2 ] = ss [ pp - 2 ] , ss [ pp ] NEW_LINE ss = ' ' . join ( ss ) NEW_LINE DEDENT DEDENT