def init_pattern(elements):
    """init_pattern(list) -> string

    Creates pattern from list sorted by length in descending order.

    """
    items = sorted(elements, key=lambda a: len(a), reverse=True)
    pattern = '|'.join(items)
    return pattern
