#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int g = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return g;
}
bool diofant_any(int a, int b, int c, int &x, int &y, int &g) {
  g = gcd(abs(a), abs(b), x, y);
  if (c % g != 0) return false;
  x *= c / g;
  y *= c / g;
  if (a < 0) x *= -1;
  if (b < 0) y *= -1;
  return true;
}
void solve() {
  int n;
  string s, res = "";
  cin >> n >> s;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      res += '0' + cnt;
      cnt = 0;
    } else
      cnt++;
  }
  res += '0' + cnt;
  cout << res;
}
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) {
    solve();
    cout << '\n';
  }
  return 0;
}
