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