def find_all(s, ss):
    """
    A helper function used in creating truth tables (truth_tables.py).
    Finds all occurrences of substring ss in string s.
    Returns a list of starting indices of ss in s. If there is no instance
    of ss in s, find_all returns an empty list.

    Example:

    >>> s = "132435132435"
    >>> find_all(s, "3")
    [1, 4, 7, 10]

    >>> s = "cat1 and cat2 were best friends."
    >>> find_all(s, "cat")
    [0, 9]

    >>> s = " hello world, world hello"
    >>> find_all(s, "hello")
    [1, 20]

    >>> s = " hello world, world hello"
    >>> find_all(s, "l")
    [3, 4, 10, 17, 22, 23]

    >>> s = "abc"
    >>> find_all(s, "z")
    []

    >>> s = "abc"
    >>> find_all(s, "abcd")
    []
    """

    # If s is empty, return an empty list.
    if len(s) == 0:
        return []

    # If ss is empty, return an empty list.
    if len(ss) == 0:
        return []

    # Initialize the list of indices.
    indices = []

    # Find the size of the string.
    size = len(s)

    # Find the size of the sub-string.
    size_ss = len(ss)

    # For every index in s, check if s[index:index+size_ss] = ss.
    # If so, append index to the list of indices.
    for index in range(size-size_ss+1):
        if s[index:index+size_ss] == ss:
            indices.append(index)

    return indices