init = input()
lines = eval(input())
def getnext(init):
# define two indicators
i, j = 0, 1
ans = “”
cnt = 1
for _ in range(len(init)):
if j <= len(init)-1 and init[i] == init[j]:
i += 1
j += 1
cnt += 1
else:
ans += str(cnt)
ans += init[i]
i += 1
j += 1
cnt = 1
return ans
for _ in range(lines):
init = getnext(init)
print(init)