def _sdiff(s1, s2):
    """return symmetric diff of strings s1 and s2, as a tuple of (letters
    unique to s1, letters common to both, letters unique to s2.

    s1 and s2 must be strings with letters in sorted order

    """

    if s1 == s2:
        return ('', s1, '')

    i1 = i2 = 0
    u1 = u2 = i = ""

    while i1 < len(s1) and i2 < len(s2):
        if s1[i1] == s2[i2]:
            i += s1[i1]
            i1 += 1
            i2 += 1
        elif s1[i1] <= s2[i2]:
            u1 += s1[i1]
            i1 += 1
        elif s2[i2] <= s1[i1]:
            u2 += s2[i2]
            i2 += 1
        else:
            assert False, "Shouldn't be here"

    u1 += s1[i1:]
    u2 += s2[i2:]

    return (u1, i, u2)