def substrings(s):
    """ Helper function. Get all substrings of a string"""

    # get substrings
    substrings = list()
    for x in range(len(s)):
        for y in range(x, len(s)):
            substrings.append(s[x:y+1])

    # order descending
    substrings = sorted(substrings, key=lambda x:len(x))

    return substrings