So yeah, just to put it all together, try this. From your two Ks, it
either returns K+1 if it can or an empty string.

def k2k1(string1, string2):
    for c in string1:
        string2 = string2.replace(c,"",1)

    if len(string2) == 1:
        string1 += string2
    else:
        string1 = ""

    return string1


Testing:

print k2k1("abcdadd", "abceadd")

gives:
abcdadde

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to