#include <bits/stdc++.h>
using namespace std;
void decodee(string len, string input);
int main() {
  string len;
  string input;
  getline(cin, len);
  getline(cin, input);
  decodee(len, input);
  return 0;
}
void decodee(string len, string input) {
  vector<int> arraynum;
  int num = 0;
  int lengh = atoi(len.c_str());
  int pos1 = 0, pos2 = 0;
  pos2 = input.find('0');
  if (pos2 == -1) {
    arraynum.push_back(lengh - pos1);
    pos2 = lengh;
  } else {
    arraynum.push_back(pos2 - pos1);
  }
  pos1 = pos2;
  while (pos2 < lengh) {
    pos1 = pos2;
    pos2 = input.find('0', pos2 + 1);
    if (pos2 == -1) {
      arraynum.push_back(lengh - pos1 - 1);
      pos2 = lengh;
    } else {
      arraynum.push_back(pos2 - pos1 - 1);
    }
  }
  for (int j = 0; j < arraynum.size(); j++) {
    int n = arraynum.at(j);
    cout << n;
  }
}
