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