#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 5;
vector<long long> ar;
long long input() {
  long long a = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') a = a * 10 + (c - '0'), c = getchar();
  return a;
}
int32_t main() {
  input();
  string s;
  cin >> s;
  s.push_back('1');
  string ans;
  long long cur = 0;
  for (long long i = 0; i < s.size() - 1; i++) {
    if (s[i] == '1') cur++;
    if (s[i + 1] == '0') ans.push_back(char(cur + '0')), cur = 0;
  }
  ans.push_back(char(cur + '0'));
  cout << ans;
  return 0;
}
