#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<char> ans;
inline void solve() {
  int i = 0;
  int ones = 0;
  while (i < n) {
    while (s[i] == '1' and i < n) {
      ++ones;
      ++i;
    }
    if (ones > 0) {
      ans.push_back('0' + ones);
      ones = 0;
    } else {
      ans.push_back(',');
      ++i;
    }
  }
  cout << ans[0];
  for (int j = int(1); j < int(ans.size()); j++) {
    char c = ans[j];
    if (c != ',') {
      cout << c;
    } else {
      if (ans[j - 1] == ',') {
        cout << '0';
      }
      if (j == (int)(ans.size() - 1)) {
        cout << '0';
      }
    }
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> s;
  solve();
  return 0;
}
