Exemple #1
0
def run():
    lines = read_file('input.txt')

    one = filter(is_nice_string, lines)
    print('part 1', p.ilen(one))

    two = filter(is_new_nice, lines)
    print('part 2', p.ilen(two))
Exemple #2
0
def run(string, num):
    """
    >>> run('1', 5)
    6
    """
    res = p.nth(num, p.iterate(look_and_say, string))
    return p.ilen(res)
Exemple #3
0
def rle(string):
    """
    >>> rle('aaabcc')
    [(3, 'a'), (1, 'b'), (2, 'c')]
    """
    return [(p.ilen(g), k) for k, g in it.groupby(string)]