Polycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm:

  Each digit is represented with number of '1' characters equal to the value of that digit (for 0 it is zero ones).  Digits are written one by one in order corresponding to number and separated by single '0' character. 

Though Polycarp learnt how to encode the numbers, he has no idea how to decode them back. Help him calculate the decoded number.


-----Input-----

The first line contains one integer number n (1 ≤ n ≤ 89) — length of the string s.

The second line contains string s — sequence of '0' and '1' characters, number in its encoded format. It is guaranteed that the number corresponding to the string is positive and doesn't exceed 10^9. The string always starts with '1'.


-----Output-----

Print the decoded number.


-----Examples-----
Input
3
111

Output
3

Input
9
110011101

Output
2031

Difficulty: EASY

Solutions:
n = int(input())
s = str(input())
result = ''
counter = 0
for i in range(s.__len__()):
	if s[i - 1] == '0' and s[i] == '0':
		if counter > 0:
			result += str(counter)
			counter = 0
		result += '0'
		continue
	if s[i] == '1':
		counter = counter + 1
	elif s[i] == '0':
		if counter > 0:
			result += str(counter)
		counter = 0
result += str(counter)
print(result)


from sys import stdin, stdout

def read_input():
	inp = []
	for line in stdin:
		inp.append(line.strip())
		if line == '\n':
			break
	return inp[1]

def decodeSeries(chars):
	count = 0
	ans = ''
	for char in chars:
		if char == '1':
			count += 1
		else:
			ans += str(count)
			count = 0
	ans += str(count)
	return ans
series = read_input()
print(decodeSeries(series))


input()
binary_number = input()
splitted = binary_number.split('0')
digits = list(map(len, splitted))
print(''.join(map(str, digits)))


input()
s = input().split('0')
message = ''
for word in s:
	message = message + str(len(word))
print(message)


def main():
	input()
	s = input()
	out = []
	cur = 0
	prev = '-'
	for c in s:
		if c == '0' and prev == '0':
			out.append(0)
			continue
		elif c == '0':
			out.append(cur)
			cur = 0
		else:
			cur += 1
		prev = c
	out.append(cur)
	print(''.join((str(x) for x in out)))
main()


n = input()
s = input().split('0')
print(''.join([str(len(x)) for x in s]))


n = int(input())
number = input()
answer = ''
count = 0
for el in range(n):
	if number[el] == '1':
		count += 1
	else:
		answer += str(count)
		count = 0
answer += str(count)
print(answer)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from itertools import permutations as pmt
from collections import Counter
n = int(input())
s = input()
if s == '0':
	print(0)
	exit()
ans = []
cnt = 0
z = 0
for i in range(n):
	if s[i] == '1':
		cnt += 1
		if z > 0:
			ans.append('0' * (z - 1))
			z = 0
	else:
		z += 1
		if cnt >= 1:
			ans.append(str(cnt))
			cnt = 0
	if i == n - 1:
		if z > 0:
			ans.append('0' * z)
		elif cnt > 0:
			ans.append(str(cnt))
print(''.join(ans))


a = input()
b = input().split('0')
for i in b:
	print(len(i), end='')


n = int(input())
sum = input().split('0')
a = ''
for i in sum:
	a += str(len(i))
print(a)


n = int(input())
s = input().split('0')
ans = ''
for a in s:
	if a == '':
		ans = ans + str(0)
	else:
		ans = ans + str(len(a))
print(ans)


input()
ans = ''
for s in input().split('0'):
	ans += str(len(s))
print(ans)


n = int(input())
a = input().split('0')
for x in a:
	print(x.count('1'), end='')


n = int(input())
a = list(input().split('0'))
for i in a:
	print(len(i), end='')


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
from math import log2, sqrt
from collections import defaultdict
n = I()
s = S()
ans = [0] * 89
c = 0
for i in s:
	if i == '1':
		ans[c] += 1
	else:
		c += 1
		ans[c] = 0
print(''.join(map(str, ans[:c + 1])))


a = input()
b = input().split('0')
ans = [0] * len(b)
for i in range(len(b)):
	ans[i] = str(len(b[i]))
print(''.join(ans))


n = int(input())
slist = input()
slist += '0'
c = 0
ans = ''
for s in slist:
	if s == '0':
		ans += str(c)
		c = 0
	else:
		c += 1
print(ans)


size = int(input())
lel = input()
number = list(lel)
original = 0
out = ''
for x in number:
	if x == '1':
		original += 1
	else:
		out = out + str(original)
		original = 0
out = out + str(original)
print(out)


n = int(input())
s = input()
A = []
cnt = 0
z = 0
for i in range(n):
	if s[i] == '1':
		if z != 0:
			A.append('0' * (z - 1))
			z = 0
		if cnt == -1:
			cnt = 0
		cnt += 1
	else:
		if cnt > 0:
			A.append(cnt)
			cnt = 0
		z += 1
if cnt > 0:
	A.append(cnt)
if z != 0:
	A.append('0' * z)
for i in A:
	print(i, end='')


n = int(input())
inputSring = input()
result = ''
while len(inputSring) > 0:
	if '0' in inputSring:
		countOfOnes = inputSring.find('0')
		result += str(countOfOnes)
		inputSring = inputSring[countOfOnes:]
	else:
		result += str(len(inputSring))
		break
	if '1' in inputSring:
		countOfZeros = inputSring.find('1')
		result += '0' * (countOfZeros - 1)
		inputSring = inputSring[countOfZeros:]
	else:
		result += '0' * len(inputSring)
		break
print(result)


n = int(input())
z = [0]
t = []
for i in input():
	t.append(int(i))
	if i == '0':
		z.append(len(t) - 1)
s = ''
for i in range(len(z) - 1):
	s += str(sum(t[z[i]:z[i + 1]]))
s += str(sum(t[z[-1]:]))
print(s)


n = int(input())
string = input()
numbers = string.split('0')
a = ''
for x in numbers:
	a += str(len(x))
a = int(a)
print(a)


N = int(input())
s = input()
r = ''
count = 0
for i in s:
	if i == '0':
		r += str(count)
		count = 0
	else:
		count += 1
r += str(count)
print(r)


n = int(input())
s = input() + '0'
i = 0
for x in range(n):
	if s[x] == '1':
		i += 1
	elif s[x] == '0':
		print(i, end='')
		i = 0
print(i, end='')


R = lambda : map(int, input().split())
(n,) = R()
s = input()
(a, curr) = (0, 0)
for i in range(n):
	if s[i] == '1':
		curr += 1
	else:
		a = a * 10 + curr
		curr = 0
a = a * 10 + curr
print(a)


def decode(info):
	for i in map(len, info.split('0')):
		print(i, end='')
	print()
input()
info = input()
decode(info)


n = int(input())
n1 = input()
s = ''
v = ''
c = 0
k = 0
lst = []
for i in n1:
	if i == '1':
		if c > 0:
			lst.append(s)
			s = ''
			c = 0
		s = s + '1'
		k = k + 1
	elif i == '0':
		if k > 0:
			lst.append(s)
			s = ''
			k = 0
		s = s + '0'
		c = c + 1
lst.append(s)
for j in range(len(lst)):
	if '1' in lst[j]:
		v = v + str(len(lst[j]))
	elif j != len(lst) - 1:
		v = v + str((len(lst[j]) - 1) * '0')
	else:
		v = v + lst[j]
print(v)


import math

def reversed_string(a_string):
	return a_string[::-1]
digits = input()
string = input()
a = []
b = []
floatingNumber = ''
a = string.split('0')
for item in a:
	b.append(item)
for item in b:
	floatingNumber = str(len(item)) + floatingNumber
print(reversed_string(floatingNumber))


n = int(input())
a = input().split('0')
ans = 0
for i in a:
	ans = ans * 10 + len(i)
print(ans)


(n, s) = (int(input()), input())
ans = ''
curr = 0
for x in s:
	if x == '1':
		curr += 1
		curr %= 10
	else:
		ans = ans + str(curr)
		curr = 0
ans += str(curr)
print(ans)


n = int(input())
s = input().split('0')
a = []
for x in s:
	a.append(str(x.count('1')))
ans = ''.join(a)
print(ans)


a = int(input())
b = input()
c = 0
if b.count('0') == 0:
	print(a)
	exit(0)
while b.count('0') > 0:
	c += b.index('0') * 10 ** b.count('0')
	b = b[b.index('0') + 1:]
c += len(b)
print(c)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(1):
		n = ii()
		s = si()
		c = 1
		l = []
		for i in range(1, n):
			if s[i] == s[i - 1]:
				c += 1
			else:
				l.append([c, s[i - 1]])
				c = 1
		l.append([c, s[-1]])
		for i in range(len(l)):
			if l[i][1] == '1':
				print(l[i][0], end='')
			else:
				if l[i][0] == 1:
					continue
				for j in range(l[i][0] - 1):
					print(0, end='')
		if s[-1] == '0':
			print(0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input()
s = input().split('0')

def main(argv):
	ans = 0
	for c in s:
		ans *= 10
		ans += len(c)
	print(ans)
main(sys.argv)


n = int(input())
s = list(input())
h = 0
k = 0
w = []
while h != n:
	k = k + int(s[h])
	if h == n - 1:
		break
	if int(s[h + 1]) == 0:
		w.append(str(k))
		k = 0
	h = h + 1
w.append(str(k))
w = ''.join(w)
print(w)


input()
s = input()
print(''.join((str(i.count('1')) for i in s.split('0'))))


input()
for x in map(len, input().split('0')):
	print(x, end='')


n = int(input())
a = input()
l = 0
mem = {'1111': '4', '11': '2', '1111111': '7', '111111111': '9', '11111111': '8', '111': '3', '111111': '6', '1': '1', '11111': '5', '': '0'}
ans = ''
i = 0
l = 0
while i < n:
	while a[i] != '0':
		i += 1
		if i >= n:
			break
	ans += mem[a[l:i]]
	i += 1
	l = i
	if i == n:
		if a[i - 1] == '0':
			ans += '0'
print(ans)


n = int(input())
s = input()
sum = 0
flag = 0
l = ''
out = ''
for c in s:
	if c == '1':
		sum += 1
		l = '1'
	elif c == '0' and l == '1':
		out += str(sum)
		sum = 0
		l = '0'
	elif c == '0' and l == '0':
		out += '0'
		sum = 0
out += str(sum)
print(out)


input()
for number in input().split('0'):
	print(len(number), end='')


n = int(input())
string = input()
astr = ''
count = 0
for i in range(n):
	if string[i] == '1':
		count += 1
	elif string[i] == '0':
		astr += str(count)
		count = 0
	elif string[i] == '0' and i > 0 and (string[i - 1] == '0'):
		astr += '0'
astr += str(count)
print(astr)


l = int(input())
s = str(input())
actualNum = 0
startFlag = True
answer = ''
for bit in s:
	if bit == '1':
		if startFlag:
			actualNum += 1
			startFlag = False
		else:
			actualNum += 1
	elif startFlag:
		answer += '0'
	else:
		answer += str(actualNum)
		actualNum = 0
answer += str(actualNum)
print(answer)


n = int(input())
s = input()
l = s.split('0')
le = len(l)
ans = 0
for i in range(le):
	t = l[i]
	ans *= 10
	ans += len(t)
print(ans)


while True:
	try:
		x = input()
		a = input()
		b = 0
		for i in a:
			if i == '1':
				b += 1
			else:
				print(b, end='')
				b = 0
		print(b)
	except EOFError:
		break


x = int(input())
a = input()
l = 0
c = []
v = ''
b = a.split('0')
for i in b:
	g = len(i)
	c.append(g)
for p in c:
	v += str(p)
print(v)


n = input()
line = input()
was = line.split('0')
for a in was:
	print(len(a), end='')


n = int(input(''))
num = list(input(''))
lis = []
count = 0
for i in range(0, n):
	if num[i] == '1':
		count += 1
	else:
		lis.append(str(count))
		count = 0
if num[n - 1] == '1':
	lis.append(str(count))
else:
	lis.append(str(0))
print(''.join(lis))


def binary(s):
	return ''.join([str(len(i)) for i in list(map(str, s.split('0')))])
n = int(input())
print(binary(input()))


a = int(input())
k = input()
lst = []
s = 0
k = k + '0'
for i in k:
	if i == '1':
		s = s + 1
	elif i == '0':
		lst.append(s)
		s = 0
for t in lst:
	print(t, end='')


n = int(input())
s = list(input().split('0'))
print(''.join([str(len(ls)) for ls in s]))


input()
count = 0
out = ''
for l in input():
	if l == '1':
		count += 1
	else:
		out = out + str(count)
		count = 0
out = out + str(count)
print(out)


n = int(input())
print(*map(len, input().split('0')), sep='')


s = input()
b = input()
t = 0
for i in b:
	pos = ord(i)
	if pos == ord('0') and pos - 1 != ord('0'):
		print(str(t), end='', flush=True)
		t = 0
	elif pos == ord('1'):
		t += 1
	else:
		print(str(t), end='', flush=True)
print(str(t))


n = input()
n = int(n)
s = str(input())
s = s.split('0')
ans = ''
for digit in s:
	ans += str(len(digit))
print(ans)


n = int(input())
s = input()
sol = ''
st = s.split('0')
for i in st:
	sol += str(len(i))
print(sol)


n = int(input())
s = input()
a = s.split('0')
ans = []
for i in a:
	if i == '':
		ans.append('0')
		continue
	ans.append(str(len(i)))
print(''.join(ans))


n = int(input())
s = input()
current_num = 0
for el in s:
	if el == '1':
		current_num += 1
	else:
		print(current_num, end='')
		current_num = 0
print(current_num)


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
n = int(input())
s = input().split('0')
for i in s:
	print(len(i), end='')


length = input('')
string = input('')
string = string.split('0')
result = ''
for i in string:
	result += str(len(i))
print(int(result))


input()
ans = ''
for st in input().split('0'):
	ans += str(st.count('1'))
print(ans)


input()
print(''.join(map(str, map(len, input().split('0')))))


input()
s = input().split('0')
print(''.join([str(len(i)) for i in s]))


n = int(input())
var = str(input())
ans = str()
pr_ans = int()
var_splited = var.split('0')
for i in range(len(var_splited)):
	if var_splited[i] != '':
		for j in range(len(var_splited[i])):
			pr_ans = pr_ans + int(var_splited[i][j])
		ans = ans + str(pr_ans)
		pr_ans = 0
	if var_splited[i] == '':
		ans = ans + '0'
print(ans)


n = int(input())
string = input()
num = 0
k = 0
for i in range(n):
	if int(string[i]) == 1:
		k += 1
	else:
		num = num * 10 + k
		k = 0
num = num * 10 + k
print(num)


n = int(input())
number = []
count = 0
for i in input():
	i = int(i)
	if i == 0:
		number.append(str(count))
		count = 0
	else:
		count += 1
number.append(str(count))
print(''.join(number))


n = int(input())
s = input().split('0')
num = ''
for i in range(len(s)):
	if s[i] == '':
		num += '0'
	else:
		num += str(s[i].count('1'))
print(num)


def find(s):
	A = []
	count = 0
	for i in range(len(s)):
		if s[i] == '1':
			count += 1
		else:
			A += [count]
			count = 0
	if s[-1] == '1':
		A += [count]
	else:
		A += [0]
	TT = ''
	for i in range(len(A)):
		TT += str(A[i])
	return TT
N = input()
s = input()
print(find(s))


import sys
pb_raw = sys.stdin.readlines()
in_len = int(pb_raw[0].strip())
pb_str = pb_raw[1].strip()
pb_str = pb_str.replace('0', ' ')
tmp = [str(len(chunk)) for chunk in pb_str.split(' ')]
sol = ''.join(tmp)
sys.stdout.writelines(sol)


def decoder(code):
	l = list(code)
	number = 0
	result = ''
	flag = 1
	for char in l:
		if char == '1':
			number += 1
			flag = 1
		elif char == '0' and flag == 1:
			result += str(number)
			flag = 0
			number = 0
		elif char == '0' and flag == 0:
			result += str('0')
			flag = 1
	result += str(number)
	print(result)
number = input()
code = input()
decoder(code)


n = input()
s = input().split('0')
ans = ''
for x in s:
	ans = ans + str(len(x))
print(ans)


n = int(input())
s = input()
t = ''
l = list(s.split('0'))
for i in l:
	if i == '':
		t += '0'
	else:
		t += str(len(i))
print(t)


n = int(input())
print(''.join((str(len(x)) for x in input().split('0'))))


n = int(input())
entrada = input().split('0')
[print(len(n), end='') for n in entrada]


n = int(input())
s = str(input())
i = 0
l = []
x = ''
for i in range(n):
	if s[i] == '0':
		l.append(i)
if l == []:
	print(n)
elif len(l) == 1:
	ans = 0
	for i in range(0, l[0]):
		if s[i] == '1':
			ans += 1
	if ans > 0:
		x += str(ans)
	ans = 0
	for i in range(l[0], n):
		if s[i] == '1':
			ans += 1
	x += str(ans)
	print(x)
else:
	ans = 0
	for i in range(0, l[0]):
		if s[i] == '1':
			ans += 1
	if ans > 0:
		x += str(ans)
	for i in range(len(l) - 1):
		ans = 0
		for j in range(l[i], l[i + 1]):
			if s[j] == '1':
				ans += 1
		if ans > 0:
			x += str(ans)
		else:
			x += '0'
	ans = 0
	for i in range(l[len(l) - 1], n):
		if s[i] == '1':
			ans += 1
	if ans > 0:
		x += str(ans)
	else:
		x += '0'
	print(x)


def f(n, string):
	result = []
	pre = 0
	for x in string:
		if x != '0':
			pre += 1
		elif pre > 0:
			result.append(str(pre))
			pre = 0
		else:
			result.append('0')
	if pre > 0:
		result.append(str(pre))
	else:
		result.append('0')
	return ''.join(result)

def t(r, value):
	if r == value:
		print('yea')
	else:
		print('nope', r)
n = input()
string = input()
print(f(n, string))


def solve():
	n = int(input())
	s = input()
	k = 0
	r = ''
	for c in s:
		if c == '0':
			r += str(k)
			k = 0
		else:
			k += 1
	r += str(k)
	return r
print(solve())


input()
print(''.join((str(len(d)) for d in input().split('0'))))


n = input()
s = input()
z = s.split('0')
decodednum = 0
for a in z:
	decodednum *= 10
	decodednum += len(a)
print(decodednum)


n = input()
s = input() + '0'
num = ''
bd = 0
for d in s:
	if d == '0':
		num += str(bd)
		bd = 0
	else:
		bd += 1
print(num)


n = int(input())
s = str(input())
ans = ''
num = 0
for i in range(n):
	if s[i] == '1':
		num += 1
	if s[i] == '0':
		if s[i - 1] == '0':
			ans += '0'
		else:
			ans += str(num)
			num = 0
	if i == n - 1:
		ans += str(num)
print(ans)


input()
s = input().split('0')
for i in s:
	print(len(i), end='')


import sys
code = sys.stdin.read().split()[1] + '0'
last = 0
for i in range(len(code)):
	if code[i] == '0':
		tok = code[last:i]
		if tok == '0':
			print('.', end='')
		else:
			print(len(tok), end='')
		last = i + 1
print('\n')


class CodeforcesTask825ASolution:

	def __init__(self):
		self.result = ''
		self.encoded = ''

	def read_input(self):
		input()
		self.encoded = input()

	def process_task(self):
		res = [len(x) for x in self.encoded.split('0')]
		self.result = ''.join([str(x) for x in res])

	def get_result(self):
		return self.result
Solution = CodeforcesTask825ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, s) = (int(input()), input())
v = 0
for i in s:
	if i in '1':
		v = v + 1
	else:
		print(v, end='')
		v = 0
print(v, end='')


n = int(input())
l = input()
s = ''
inp = ''
for i in range(n):
	if l[i] == '1':
		s += l[i]
	else:
		if len(s) == 0:
			inp += '0'
		else:
			inp += str(len(s))
		s = ''
inp += str(len(s))
print(inp)


n = input()
s = input()
for item in s.split('0'):
	item = item.strip()
	if not len(item):
		print('0', end='')
	else:
		print(len(item), end='')


(n, a) = (int(input()), input()[::-1])
(o, j) = (0, 0)
for i in range(n):
	if a[i] == '0':
		j += 1
	else:
		o += 10 ** j
print(o)


size = input()
inp = input()
counter = 0
separator_zero = True
number = ''
for l in inp:
	if l != '0':
		separator_zero = True
		counter += 1
	elif counter > 0:
		number += str(counter)
		separator_zero = False
		counter = 0
	elif separator_zero:
		separator_zero = False
	else:
		number += '0'
number += str(counter)
print(number)


n = int(input())
s = input()
k = 0
b = ''
for i in range(n):
	if s[i] == '1':
		k += 1
	elif s[i] == '0' and s[i - 1] == '0':
		b += '0'
		k = 0
	else:
		b += str(k)
		k = 0
	if i == n - 1:
		b += str(k)
		k = 0
print(b)


import sys
input = sys.stdin.readline
num = ''
cnt = 0
input()
for ch in input().strip() + '0':
	if ch == '1':
		cnt += 1
	else:
		num += str(cnt)
		cnt = 0
print(num)


t = int(input())
n = input()
p = n.split('0')
for i in range(len(p)):
	print(len(p[i]), end='')


n = int(input())
s = input()
r = list()
i = k = 0
while i < n:
	if s[i] == '1':
		k += 1
	elif s[i] == '0' and k == 0:
		r.append(0)
	else:
		r.append(k)
		k = 0
	i += 1
r.append(k)
for i in r:
	print(i, end='')


n = int(input())
a = input()
kek = ''
s = 0
for i in a:
	if i == '0':
		kek += str(s)
		s = 0
	else:
		s += 1
else:
	kek += str(s)
print(kek)


(lambda _, s: print(''.join(map(str, map(len, s.split('0'))))))(input(), input())


n = int(input())
s = str(input())
l = s.split('0')
e = ''
for i in range(0, len(l)):
	e = e + str(len(l[i]))
print(e)


n = int(input())
print(*[len(x) for x in input().split('0')], sep='')


input()
s = input().strip()
n = 0
for c in s:
	if c == '1':
		n += 1
	else:
		print(n, end='')
		n = 0
print(n)


input()
s = input().split('0')
for d in s:
	print(len(d), end='')


input()
s = input()
print(''.join(map(str, list(map(len, s.split('0'))))))


n = int(input())
s = input().strip()
print(*map(len, s.split('0')), sep='')


n = int(input())
s = str(input())
q = ''
r = 0
p = []
for i in s:
	if i == '1':
		r = r + 1
	else:
		p.append(r)
		r = 0
p.append(r)
for i in p:
	q = q + str(i)
print(q)


def main():
	n = input()
	coded = input()
	print(''.join([str(len(x)) for x in coded.split('0')]))
main()


(n, t) = (input(), 0)
for c in input():
	if c == '0':
		t *= 10
	else:
		t += 1
print(t)


n = int(input())
str1 = input()
list1 = list(str1)
count1 = 0
newList = []
for i in range(len(list1)):
	if list1[i] == '1':
		count1 += 1
	else:
		newList.append(str(count1))
		count1 = 0
newList.append(str(count1))
print(''.join(newList))


n = int(input())
s = input()
d = 0
t = ''
for i in s:
	if i == '1':
		d += 1
	else:
		t = t + str(d)
		d = 0
t = t + str(d)
print(t)


n = int(input())
s = input()
list = []
t = 0
while t < n:
	list.append(int(s[t]))
	t += 1
f = []
j = 0
i = 0
while i <= n:
	if i < n and list[i] == 1:
		j += 1
		i += 1
	elif i < n and list[i] == 0:
		f.append(j)
		j = 0
		i += 1
	else:
		f.append(j)
		i += 1
m = len(f)
k = m - 1
r = 0
p = 0
while k >= 0:
	r = f[p] * 10 ** k + r
	k -= 1
	p += 1
print(r)


n = int(input())
s = list(input())
ans = [0] * (s.count('0') + 1)
raz = 0
ans1 = ''
for i in range(len(s)):
	if int(s[i]) == 1:
		ans[raz] += 1
	else:
		raz += 1
for i in range(len(ans)):
	ans1 += str(ans[i])
print(ans1)


len = int(input())
code = input()
cont = 0
result = ''
for i in range(len):
	if code[i] == '0':
		if cont != 0:
			result += str(cont)
			cont = 0
		else:
			result += '0'
	elif code[i] == '1':
		cont += 1
if cont != 0:
	result += str(cont)
else:
	result += '0'
print(result)


import sys
sys.stdin.readline()
second_line = sys.stdin.readline()[:-1]
nums = second_line.split('0')
ans = ''
for num in nums:
	ans += str(len(num))
print(ans)


def main():
	input()
	t = input()
	c = 0
	ans = 0
	for i in t:
		if i == '1':
			c += 1
		else:
			ans += c
			ans *= 10
			c = 0
	ans += c
	print(ans)
main()


n = int(input())
s = list(input().split('0'))
print(''.join(map(lambda ls: str(len(ls)), s)))


n = input()
a = list(map(str, input().split('0')))
ans = ''
for i in a:
	ans += str(len(i))
print(ans)


n = int(input())
line = input()
ans = 0
for s in line.split('0'):
	ans *= 10
	ans += len(s)
print(ans)


n = int(input())
s = list(input().split('0'))
t = ''
for i in s:
	t += str(len(i))
print(t)


import math
n = int(input())
s = input()
array = []
result = ''
for i in s.split('0'):
	array.append(i)
for i in range(len(array)):
	counter = 0
	for j in range(len(array[i])):
		counter += 1
	result += str(counter)
print(result)


t = input()
s = input() + '0'
i = 0
j = 0
ans = ''
while j < len(s):
	i = 0
	while s[j] != '0':
		j += 1
		i += 1
	ans += str(i)
	j += 1
print(ans)


(n, s) = (int(input()), input())
res = []
x = 0
i = 0
while i < n:
	if s[i] == '1':
		x += 1
	elif not x:
		res.append(0)
	else:
		res.append(x)
		x = 0
	i += 1
if x:
	res.append(x)
else:
	res.append(0)
print(''.join([str(x) for x in res]))


N = int(input())
li = input().split('0')
for i in range(len(li)):
	li[i] = li[i].count('1')
if len(li) == 0:
	print('0')
else:
	li = map(str, li)
	print(''.join(li))


n = input()
string = input()
ans = string.split('0')
res = 0
for item in ans:
	res *= 10
	res += item.count('1')
print(res)


x = int(input())
s = input()
s2 = ''
c = 0
x = len(s)
i = 0
while True:
	if s[i] == '1':
		c += 1
		i += 1
	elif s[i] == '0':
		s2 = s2 + str(c)
		c = 0
		while s[i] != '1':
			c += 1
			i += 1
			if i == len(s):
				break
		for j in range(c - 1):
			s2 = s2 + '0'
		c = 0
	if i >= len(s):
		break
if s[len(s) - 1] != '0':
	s2 = s2 + str(c)
if s[len(s) - 1] == '0':
	s2 = s2 + '0'
print(s2)


n = input()
s = input()
d = 0
c = 0
for i in range(len(s)):
	if s[i] == '0':
		c = c * 10 + d
		d = 0
	else:
		d = d + 1
c = c * 10 + d
print(c)


import sys
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
n = ni()
s = ns()
ct = 0
for i in range(n):
	if s[i] == '1':
		ct += 1
	else:
		print(ct, end='')
		ct = 0
print(ct)


n = input()
n = input().split('0')
l = []
for i in n:
	if i == '':
		l.append('0')
	else:
		l.append(str(len(i)))
print(''.join(l))


n = int(input())
A = input()
res = []
i = 0
c = 0
while i < len(A):
	if A[i] == '0':
		res += [c]
		c = 0
	else:
		c += 1
	i += 1
res += [c]
print(''.join(map(str, res)))


n = int(input())
ans = 0
s = str(input())
for i in range(n):
	if s[i] == '1':
		ans += 1
		if i == n - 1:
			print(ans, end='')
	elif s[i] == '0':
		print(ans, end='')
		if i == n - 1:
			print('0', end='')
		ans = 0
	elif s[i] == '0' and s[i - 1] == '0':
		print('0', end='')
		ans = 0


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
s = input() + '0'
ans = [0]
for i in range(n):
	if s[i] == '0':
		ans.append(0)
	else:
		ans[-1] += 1
ans = [str(a) for a in ans]
ans = ''.join(ans)
print(ans)


t = int(input())
s = input()
s = s.split('0')
ans = ''
for i in s:
	ans = ans + str(len(i))
print(ans)


input()
print(''.join([str(len(i)) for i in input().strip().split('0')]))


n = int(input())
s = input()
z = 0
o = 0
res = ''
for i in s:
	if i == '1':
		while z > 1:
			res += '0'
			z -= 1
		z = 0
		o += 1
	else:
		if o > 0:
			res += str(o)
		o = 0
		z += 1
if o > 0:
	res += str(o)
while z > 0:
	res += '0'
	z -= 1
print(res)


n = int(input())
s = input() + '0'
answer = 0
current = 0
for i in range(n + 1):
	if s[i] == '1':
		current += 1
	else:
		answer = answer * 10 + current
		current = 0
print(answer)


input()
print(''.join(list(map(lambda x: str(len(x)), input().split('0')))))


n = int(input())
encoded_num = input() + '0'
num_of_1s = 0
res = 0
for char in encoded_num:
	if char == '1':
		num_of_1s += 1
	else:
		res = res * 10 + num_of_1s
		num_of_1s = 0
print(res)


n = int(input())
ss = input()
ss = ss.split('0')
for i in ss:
	print(len(i), end='')


n = int(input())
num = str(input())
count = 0
answer = ''
for c in num:
	if c == '1':
		count += 1
	else:
		answer += str(count)
		count = 0
if count >= 0:
	answer += str(count)
print(answer)


n = int(input())
q = list(input())
i = 0
c = []
s = 0
while i < n:
	if q[i] == '1':
		s = s + 1
	else:
		c.append(s)
		s = 0
	i = i + 1
c.append(s)
for i in range(len(c)):
	print(c[i], end='')


n = int(input())
s = input() + '0'
ans = 0
i = 0
while i < n:
	ctr = 0
	while s[i] != '0':
		ctr += 1
		i += 1
	i += 1
	ans *= 10
	ans += ctr
if s[n - 1] == '0':
	ans *= 10
print(ans)


length = input()
s = input()
s = s.split('0')
result = ''
for i in s:
	result += str(len(i))
print(result)


n = int(input())
s = input()
curr = 0
for char in s:
	if char == '1':
		curr += 1
	else:
		print(curr, end='')
		curr = 0
print(curr)


def solve():
	n = get(int)
	s = ''.join(map(str, map(len, get(str).split('0'))))
	return s
	return None
_testcases = '\n3\n111\n\n3\n\n9\n110011101\n\n2031\n\n'.strip()
import re
import sys
import math
import heapq
from heapq import heapify, heappop, heappush
import bisect
from bisect import bisect_left, bisect_right
import operator
from operator import itemgetter, attrgetter
import itertools
import collections
inf = float('inf')
sys.setrecursionlimit(10000)

def tree():
	return collections.defaultdict(tree)

def cache(func):
	cache_dict = {}

	def _cached_func(*args, _get_cache=False):
		if _get_cache:
			return cache_dict
		if args in cache_dict:
			return cache_dict[args]
		cache_dict[args] = func(*args)
		return cache_dict[args]
	return _cached_func

def equal(x, y, epsilon=1e-06):
	if -epsilon <= x - y <= epsilon:
		return True
	if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
		return False
	return -epsilon <= (x - y) / x <= epsilon or -epsilon <= (x - y) / y <= epsilon

def get(_type):
	if type(_type) == list:
		if len(_type) == 1:
			_type = _type[0]
			return list(map(_type, input().strip().split()))
		else:
			return [_type[i](inp) for (i, inp) in enumerate(input().strip().split())]
	else:
		return _type(input().strip())
print(solve())


import sys
input()
s = input()
s = list(map(len, s.split('0')))
for c in s:
	sys.stdout.write(str(c))
print()


size = int(input())
string = input()
list_ = list(string)
answer = []
counter = 0
for i in range(0, size):
	if list_[i] == '1':
		counter += 1
	else:
		answer.append(counter)
		counter = 0
answer.append(counter)
mystring = ''
for digit in answer:
	mystring += str(digit)
print(mystring)


n = int(input())
st = input()
ans = []
num = 0
for i in range(n):
	if st[i] == '1':
		num += 1
	else:
		ans.append(num)
		num = 0
ans.append(num)
print(*ans, sep='')


n = int(input())
s = input()
st = ''
count = 0
for i in range(n):
	if s[i] == '0':
		st += str(count)
		count = 0
		continue
	if s[i] == '1':
		count += 1
if count:
	st += str(count)
if s[-1] == '0':
	st += '0'
print(st)


input()
s = input()
res = ''
for i in s.split('0'):
	res += str(len(i))
print(res)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	n = input()
	s = input()
	cur = 0
	ans = []
	for i in s:
		if i == '1':
			cur += 1
		else:
			ans += [cur]
			cur = 0
	ans += [cur]
	print(*ans, sep='')


n = input()
s = input()
s = s.split('0')
for m in s:
	print(len(m), end='')
print()


n = int(input())
L = input()
K = []
m = 0
for h in L:
	if h == '1':
		m += 1
	else:
		K.append(m)
		m = 0
K.append(m)
print(int(''.join((str(x) for x in K))))


r = int(input())
string1 = input()
list1 = string1.split('0')
list2 = []
for u in list1:
	if u == '':
		list2.append('0')
	else:
		list2.append(str(u.count('1')))
print(''.join(list2))


input()
print(''.join(map(lambda x: str(len(x)), input().strip().split('0'))))


n = int(input())
s = input()
num = 0
for i in range(n):
	if s[i] == '1':
		num += 1
	else:
		print(num, end='')
		num = 0
print(num)


n = int(input())
s = input()
ans = ''
array_from_s = s.split('0')
for c in array_from_s:
	ans += str(len(c))
print(ans)


n = int(input())
x = input().split('0')
for i in x:
	print(len(i), end='')


n = int(input())
s = input()
j = 0
for i in range(s.count('0')):
	x = 0
	while s[j] != '0':
		x += 1
		j += 1
	j += 1
	print(x, end='')
print(n - j)


n = int(input())
ans = ''
for i in input().split('0'):
	ans += str(len(i))
print(ans)


a = input()
a = input()
ans = 0
for i in a:
	if i == '1':
		ans += 1
	else:
		print(ans, end='')
		ans = 0
print(ans)


import sys, math
t = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
s = s.split('0')
ans = ''
for term in s:
	ans += str(len(term))
sys.stdout.write(ans)


n = int(input())
s = input()
ans = []
cur = 0
for i in range(n):
	if s[i] == '1':
		cur += 1
	else:
		ans.append(cur)
		cur = 0
ans.append(cur)
for i in ans:
	print(i, end='')


n = input()
[print(len(i), end='') for i in input().split('0')]


def Binary(l):
	result = ''
	p1 = [list(y) for y in l.split('0')]
	for x in p1:
		if x == '':
			result = result + '0'
			continue
		result = result + str(sum([int(h) for h in x]))
	print(result)
input()
Binary(input())


n = int(input())
s = input()
c = 0
r = ''
if n == 1:
	print(s)
else:
	for i in range(n - 1):
		if s[0] == '0':
			c = 0
		elif s[i] == '1':
			c = c + 1
		elif s[i - 1] == '1' and s[i] == '0':
			r = r + str(c)
			c = 0
		elif s[i - 1] == '0' and s[i] == '0':
			r = r + '0'
			c = 0
	if s[-1] == '1' and s[-2] == '0':
		r = r + '1'
	elif s[-1] == '1' and s[-2] == '1':
		c = c + 1
		r = r + str(c)
	elif s[-1] == '0' and s[-2] == '0':
		r = r + '00'
	elif s[-1] == '0' and s[-2] == '1':
		r = r + str(c) + '0'
	print(r)


def binary():
	n = input()
	S = input()
	ans = ''
	spliced_s = S.split('0')
	for x in spliced_s:
		ans += str(len(x))
	print(ans)
binary()


input()
print(*[len(i) for i in input().split('0')], sep='')


input()
print(''.join([str(len(i)) for i in list(map(str, input().split('0')))]))


n = int(input())
s = input().split('0')
for i in s:
	print(len(i), end='')


s = input()
s = ''
for x in input().split('0'):
	s += str(len(x))
print(s)


input()
print(*map(len, input().split('0')), sep='')


import sys
n = int(input())
s = input()
cnt = 0
res = ''
for i in range(n):
	if s[i] == '1':
		cnt += 1
	elif s[i] == '0':
		res += str(cnt)
		cnt = 0
	if i == n - 1:
		res += str(cnt)
print(res)


input()
s = input()
l = s.split('0')
ans = ''
for d in l:
	ans += str(len(d))
print(ans)


import sys
n = int(sys.stdin.readline())
second_string = sys.stdin.readline().split('0')
num = 0
for (i, s) in enumerate(reversed(second_string)):
	num += len(s) * pow(10, i)
sys.stdout.write(str(num - 1))


n = int(input())
m = input()
ans = ''
k = 0
for i in range(n):
	if m[i] == '1':
		k += 1
	elif k == 0:
		ans += '0'
	else:
		ans += str(k)
		k = 0
ans += str(k)
print(ans)


import sys
n = int(input())
s = input().split('0')
print(*map(str, (len(one) for one in s)), sep='')


n = int(input())
s = input()
k = 0
r = ''
for i in s:
	if i == '1':
		k += 1
	if i == '0':
		r += str(k)
		k = 0
r += str(k)
print(r)


l = input()
s = input()
out = ''
for i in s.split('0'):
	out += str(len(i))
print(out)


n = input()
s = input()
tmp = s.split('0')
l = ''
for i in tmp:
	l += str(len(i))
print(l)


import sys
input = sys.stdin.readline
n = int(input())
ans = []
for k in input().rstrip().split('0'):
	ans.append(len(k))
print(*ans, sep='')


n = int(input())
a = input()
new = ''
c = 0
m = '1'
for i in a:
	if i == m:
		c += 1
	else:
		if m == '0':
			new += '0' * (c - 1)
		else:
			new += str(c)
		m = i
		c = 1
if m == '0':
	new += '0' * c
else:
	new += str(c)
print(new)


def list_input():
	return list(map(int, input().split()))
n = int(input())
s = input()
s += '0'
n += 1
p = 0
res = list()
while p < n:
	q = p
	while q < n and s[q] == '1':
		q += 1
	x = q - p
	if x > 0:
		res.append(x)
	if p == q:
		res.append(0)
	p = q + 1
print(''.join(map(str, res)))


n = int(input())
s = input()
freq = [0]
(j, flag) = (0, 0)
for i in range(len(s)):
	if s[i] == '1':
		if flag == 1:
			freq.append(0)
			freq[j] += 1
			flag = 0
		else:
			freq[j] += 1
	elif flag == 1:
		j += 1
		pass
	else:
		j += 1
		tmp = i
		lst = 0
		ok = False
		while True:
			lst += 1
			tmp += 1
			if tmp == len(s):
				break
			if s[tmp] == '1':
				ok = True
				break
		if ok:
			lst = [0] * (lst - 1)
			freq += lst
		else:
			lst = [0] * lst
			freq += lst
		flag = 1
for i in freq:
	print(i, end='')


def main():
	N = int(input())
	S = input()
	num = 0
	ans = ''
	for i in range(N):
		if S[i] == '1':
			num += 1
		elif not num:
			ans = ans + '0'
		else:
			ans = ans + str(num)
			num = 0
	else:
		ans = ans + str(num)
	print(ans)
main()


useless = int(input())
n = input()
res = 0
h = 0
p = 0
for e in n[::-1]:
	if int(e) == 1:
		h += 1
	else:
		res = res + 10 ** p * h
		p += 1
		h = 0
res = res + 10 ** p * h
print(res)


def main():
	input()
	r = 0
	for d in map(len, input().split('0')):
		r = r * 10 + d
	print(r)
main()


n = int(input().strip())
s = input().strip()
ans = ''
cnt = 0
for i in range(n):
	if s[i] != '0':
		cnt += 1
	else:
		ans += str(cnt)
		cnt = 0
ans += str(cnt)
print(ans)


n = int(input())
start_str = input()
final_str = ''
assert len(start_str) == n
l = list(start_str)
cur_num = 0
k = 0
for i in range(len(l)):
	if int(l[i]) == 1:
		k = 0
		cur_num += 1
	elif int(l[i]) == 0 and k == 0:
		k += 1
		final_str += str(cur_num)
		cur_num = 0
	elif int(l[i]) == 0 and k >= 1:
		final_str += '0'
final_str += str(cur_num)
print(final_str)


import sys
n = int(sys.stdin.readline())
arr = list(sys.stdin.readline().rstrip())
cnt = 0
ans = []
for i in range(n):
	if arr[i] == '0':
		ans.append(cnt)
		cnt = 0
	else:
		cnt += 1
ans.append(cnt)
print(''.join(map(str, ans)))


n = int(input())
A = [int(A) for A in input().strip('')]

def soulition(A):
	count = []
	Sum = 0
	for i in range(len(A)):
		if A[i] == 1:
			Sum += 1
		if A[i] == 0:
			count.append(Sum)
			Sum = 0
	count.append(Sum)
	count = ''.join((str(e) for e in count))
	return count
print(soulition(A))


def main():
	N = int(input())
	S = list(input())
	count = 0
	res = ''
	for s in S:
		if s == '1':
			count += 1
		else:
			res += str(count)
			count = 0
	res += str(count)
	print(res)
main()


n = int(input())
s = input()
i = 0
while i < n:
	c = 0
	f = 0
	while i < n and s[i] != '0':
		c += 1
		f = 1
		i += 1
	if f == 1:
		print(c, end='')
	c = 0
	while i < n and s[i] == '0':
		c += 1
		i += 1
	if c >= 1:
		print((c - 1) * '0', end='')
		if i >= n:
			print('0')


S = int(input())
s = input().split('0')
ans = ''
for c in s:
	ans += str(len(c))
print(ans)


n = int(input())
x = input().split('0')
out = []
for d in x:
	out.append(str(len(d)))
print(''.join(out))


def binarycode(A):
	front = 0
	end = 1
	count = 0
	res = []
	while front < len(A) and end <= len(A):
		if front < len(A) and A[front] == 0:
			while front < len(A) and A[front] == 0:
				res.append(0)
				front = front + 1
			end = front + 1
		if (end < len(A) and A[end] == 0 or end == len(A)) and (front < len(A) and A[front] != 0):
			res.append(end - front)
			front = end + 1
		end = end + 1
	if A[len(A) - 1] == 0:
		res.append(0)
	return res
size = int(input())
A = list(map(int, input()))
res = binarycode(A)
for i in res:
	print(i, end='')


n = int(input())
s = input()
count = 1
for i in range(1, n):
	if s[i] == '0' and s[i - 1] != '0':
		print(count, end='')
		count = 0
	elif s[i] == '1':
		count += 1
	elif s[i] == '0':
		print(0, end='')
print(count, end='')


n = int(input())
s = input().split('0')
result = ''
for each in s:
	result += str(len(each))
print(result)


input()
k = 0
for c in input():
	if c == '1':
		k += 1
	else:
		print(k, end='')
		k = 0
print(k)


result = []
count = input()
lst = input().split('0')
while len(lst):
	result.append(str(len(lst.pop(0))))
print(''.join(result))


n = int(input()) + 1
s = input() + '0'
cnt = 0
for i in range(n):
	if s[i] == '1':
		cnt += 1
	if s[i] == '0':
		print(cnt, end='')
		cnt = 0


def read():
	return [int(e) for e in input()]
no = read()
x = read()
i = 1
s = ''
a = 0
for e in x:
	if e == 1:
		a += 1
		i = 1
	elif e == 0 and i == 0:
		s += str(0)
	else:
		s += str(a)
		i = 0
		a = 0
s += str(a)
print(s)


n = int(input())
s = str(input())
(ans, count) = (0, 0)
for i in range(n):
	if s[i] == '0':
		ans *= 10
		ans += count
		count = 0
	else:
		count += 1
	if i == n - 1:
		ans *= 10
		ans += count
		count = 0
print(ans)


n = int(input())
st = input()
out = ''
curr = 0
for e in st:
	if e == '1':
		curr += 1
	if e == '0':
		out += str(curr)
		curr = 0
out += str(curr)
print(out)


l = int(input())
data = input().split('0')
for i in data:
	print(len(i), end='')


n = int(input())
s = input()
l = s.split('0')
if s == '0':
	print(0)
else:
	for i in l:
		if i == '':
			print(0, end='')
		else:
			print(len(i), end='')


n = input()
t = input()
cnt = 0
s = ''
for i in t:
	if i == '0':
		s += str(cnt)
		cnt = 0
	else:
		cnt += 1
s += str(cnt)
print(s)


(n, c, v) = (int(input()), 0, 0)
for ch in input():
	if ch == '0':
		(c, v) = (0, 10 * v + c)
	else:
		c += 1
print(10 * v + c)


n = int(input())
z = input()
cnt = 0
for i in z:
	if i == '0':
		print(cnt, end='')
		cnt = 0
	else:
		cnt += 1
print(cnt)


n = int(input())
s = input()
r = ''
c = 0
for i in s:
	if i == '1':
		c = c + 1
	else:
		r = r + str(c)
		c = 0
r = r + str(c)
print(r)


n = input()
res = ''.join([str(len(i)) for i in input().split('0')])
print(res, end='')


n = input()
s = input()
counter = 0
ans = ''
for i in s:
	if i == '1':
		counter += 1
	else:
		ans += str(counter)
		counter = 0
ans += str(counter)
print(ans)


n = int(input())
s = input()
t = 0
for i in s:
	if i == '1':
		t += 1
	else:
		print(t, sep='', end='')
		t = 0
print(t, sep='', end='')


num = input()
string = input() + '0'
output = ''
count = 0
for i in string:
	if i == '1':
		count += 1
	if i == '0':
		output += str(count)
		count = 0
print(output)


n = int(input())
m = input()
s = ''
x = 0
cnt = 0
while x < n:
	if m[x] == '1':
		cnt += 1
	else:
		if m[x - 1] == '0':
			s += '0'
		else:
			s += str(cnt)
		cnt = 0
	x += 1
s += str(cnt)
print(s)


n = int(input())
s = list(input())
a = []
c = 0
for i in range(n):
	if int(s[i]) == 1:
		c += 1
	elif int(s[i]) == 0:
		a.append(c)
		c = 0
a.append(c)
print(*a, sep='')


n = int(input())
s = input()
i = 0
k = 0
l = ''
for i in range(n):
	if s[i] == '1':
		k += 1
	else:
		l += str(k)
		k = 0
l += str(k)
print(l)


n = int(input())
s = input()
(k1, k0) = (0, 0)
a = 0
for i in range(n):
	if s[i] == '0':
		a = a * 10 + k1
		k1 = 0
	else:
		k1 += 1
else:
	a = a * 10 + k1
print(a)


n = int(input())
s = input()
l = []
c = 1
for i in range(1, n):
	if s[i] == '1':
		c += 1
	else:
		l.append(c)
		c = 0
l.append(c)
print(''.join(map(str, l)))


n = int(input())
a = [int(x) for x in input()]
res = []
r = 0
for i in range(n):
	r += a[i]
	if a[i] == 0:
		res.append(r)
		r = 0
res.append(r)
for i in range(len(res)):
	print(res[i], end='')


n = input()
x = input().split('0')
res = ''
for i in x:
	res += str(len(i))
print(res)


s = input()
s = str(input())
val = ''
count = 0
for a in s:
	if a == '1':
		count += 1
	else:
		val += str(count)
		count = 0
val += str(count)
print(val)


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
n = sInt()
a = input()
a = list(a)
ans = []
val = 0
i = 0
while True:
	if a[i] == '1':
		val += 1
		i += 1
	elif a[i] == '0' and a[i - 1] == '1':
		ans.append(val)
		val = 0
		i += 1
	else:
		ans.append(0)
		i += 1
	if i == len(a):
		if val != 0:
			ans.append(val)
		if ans[-1] == 0 or a[-1] == '0':
			ans.append(0)
		break
print(*ans, sep='')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def decode(encoded_string):
	decoded_string = []
	counter = 0
	for char in encoded_string:
		if char == '1':
			counter = counter + 1
		elif char == '0':
			decoded_string.append(str(counter))
			counter = 0
	decoded_string.append(str(counter))
	return ''.join(decoded_string)
str_length = inp()
encoded_string = insr()
result = decode(encoded_string)
print(result)


n = int(input())
a = input()
x = ''
t = 0
for i in range(n):
	if a[i] == '1':
		t += 1
		h = 0
	elif a[i] == '0':
		if a[i - 1] == '0':
			x += '0'
		else:
			x += str(t)
			t = 0
	if i == n - 1:
		x += str(t)
print(x)


input()
a = input().split('0')
ans = ''
for x in a:
	ans += str(len(x))
print(ans)


import sys
n = int(input())
text = input()
text = text.split('0')
a = ''
for i in text:
	if i == '':
		a += '0'
	else:
		a += str(len(i))
print(a)


n = int(input())
s = list(input().split('0'))
ans = []
for i in range(len(s)):
	ans.append(len(s[i]))
print(*ans, sep='')


def binary():
	count = 0
	oList = []
	S = input()
	T = input()
	sList = S.split()
	tList = []
	for x in T[0:len(T):1]:
		tList.append(x)
	tList = [int(i) for i in tList]
	tList.append(0)
	sList = [int(i) for i in sList]
	n = sList[0]
	for x in range(len(tList) - 1):
		if tList[x] == 1 and tList[x + 1] == 1:
			count += 1
		elif tList[x] == 1 and tList[x + 1] == 0:
			count += 1
			oList.append(str(count))
		elif tList[x] == 0 and tList[x + 1] == 1:
			count = 0
		elif tList[x] == 0 and tList[x + 1] == 0:
			oList.append('0')
	print(int(''.join(oList)))
binary()


n = int(input())
s = list(input())
k = 0
d = ''
for i in range(n):
	if s[i] == '1':
		k += 1
	else:
		d = d + str(k)
		k = 0
d = d + str(k)
print(d)


n = int(input())
s = input()
c = 0
for x in range(n):
	if s[x] == '1':
		c += 1
	else:
		print(c, end='')
		c = 0
print(c)