f | def LookSay(): | f | def LookSay(): |
n | res = [1] | n | result = [1] |
| yield 1 | | yield 1 |
n | while True: | n | while 1: |
| curr_dig = res[0] | | current = result[0] |
| __iter = [] | | next_iter = [] |
| n = 1 | | counter = 1 |
| for i in res[1:] + [-1]: | | for i in result[1:] + [-1]: |
| if i != curr_dig: | | if i != current: |
| yield n | | yield counter |
| yield curr_dig | | yield current |
| __iter.extend([n, curr_dig]) | | next_iter.extend([counter, current]) |
| n = 1 | | counter = 1 |
| curr_dig = i | | current = i |
| else: | | else: |
t | n += 1 | t | counter += 1 |
| res = __iter | | result = next_iter |
| import sys | | import sys |
| exec(sys.stdin.read(), globals()) | | exec(sys.stdin.read(), globals()) |