loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
n = int(input())
nstr = "1"

for _ in range(n):
    nextn = ""
    current = nstr[0]
    counter = 1
    
    for i in nstr[1:]:
        if i == current:
            counter += 1
        else:
            nextn += str(counter) + current
            current = i
            counter = 1
    
    nextn += str(counter) + current
    nstr = nextn
    
print(nstr)