#include <bits/stdc++.h>
using namespace std;
bool bit(int n, int i) { return (n & (1 << i)) > 0; }
int dp[100001][31];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n = 0;
  string s;
  cin >> n >> s;
  n = 0;
  for (char v : s)
    if (v == '1')
      n++;
    else {
      cout << n;
      n = 0;
    }
  cout << n;
  return 0;
}
