#include <bits/stdc++.h>
using namespace std;
void Weapons19() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  Weapons19();
  string s;
  cin >> s;
  vector<long long> vis(1005, 0);
  long long n = s.size();
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    if (s[i] == ',') v.push_back(i);
  }
  v.push_back(n);
  long long t = 0;
  for (long long i = 0; i < v.size(); i++) {
    long long k = stoi(s.substr(t, v[i] - t));
    vis[k] = 1;
    t = v[i] + 1;
  }
  long long os = 0, fn = 0;
  for (long long i = 1; i < 1005; i++) {
    if (vis[i] == 1 && os == 0) {
      os = 1;
      if (fn == 0) {
        cout << i;
        fn = 1;
      } else
        cout << "," << i;
    } else if (vis[i] == 1 && os > 0) {
      os++;
      continue;
    } else if (vis[i] == 0 && os == 0)
      continue;
    else if (vis[i] == 0 && os > 0) {
      if (os != 1) {
        cout << "-" << i - 1;
      }
      os = 0;
    }
  }
}
