def substrings(a, b, n):
    """Return substrings of length n in both a and b"""

    def substring_parse(string, n):
        length = len(string)
        substrings = set()
        for i in range(length - n + 1):
            substrings.add(string[i:i+n])
        return substrings

    # parsing a into substrings
    a = substring_parse(a, n)
    # parsing b into substrings
    b = substring_parse(b, n)

    common_lines = a & b

    return list(common_lines)