def lcp(s1, s2):
    """longest common prefix

    >>> lcp('abcdx', 'abcdy'), lcp('', 'a'), lcp('x', 'yz')
    (4, 0, 0)
    """
    i = 0
    for i, (c1, c2) in enumerate(zip(s1, s2)):
        if c1 != c2:
            return i
    return min(len(s1), len(s2))
