#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  vector<string> splitted;
  stringstream ss(s);
  string item;
  while (getline(ss, item, ',')) {
    splitted.push_back(item);
  }
  int MAX = 1001;
  vector<bool> a(MAX + 1);
  for (const string& page : splitted) {
    a[stoi(page)] = true;
  }
  vector<pair<int, int>> ret;
  int p = 0;
  while (p <= MAX) {
    if (a[p]) {
      int from = p;
      int to = from;
      while (a[to]) {
        ++to;
      }
      ret.emplace_back(from, to - 1);
      p = to;
    } else {
      ++p;
    }
  }
  for (int i = 0; i < ret.size(); ++i) {
    int from = ret[i].first;
    int to = ret[i].second;
    cout << from;
    if (to != from) {
      cout << '-' << to;
    }
    if (i != ret.size() - 1) {
      cout << ',';
    }
  }
  cout << '\n';
  return 0;
}
