#include <bits/stdc++.h>
using namespace std;
const int MAX = 1005;
string s;
int cnt;
int main() {
  cin >> cnt;
  cin >> s;
  cnt = 0;
  for (int i = 0; i <= (int)s.size() - 1; i++) {
    if (s[i] == '1')
      cnt++;
    else
      cout << cnt, cnt = 0;
  }
  cout << cnt;
  cout << endl;
  return 0;
}
