#include <bits/stdc++.h>
using namespace std;
int n;
string s, res = "";
int main() {
  cin >> n >> s;
  char ch = '0';
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '0') {
      res += ch;
      ch = '0';
    } else
      ch = (char)(ch + 1);
  }
  res += ch;
  cout << res;
  return 0;
}
