def common_isuffix(*strings): """Return the length of the common suffix of strings""" i = -1 for i in xrange(0, min(len(s) for s in strings)): if not eq(*(s[len(s) - i - 1] for s in strings)): return i return i + 1
def common_iprefix(*strings): """Return the length of the common prefix of strings""" i = 0 for i in xrange(0, min(len(s) for s in strings)): if not eq(*(s[i] for s in strings)): return i return i