#include <bits/stdc++.h>
using namespace std;
const int INF = 1 * 1e9;
const long long limit = 1 * 1e18;
const int mod = 1e9 + 7;
const int MOD = 1e9 + 711;
const int MOD2 = 1e9 + 933;
const int MOD3 = 1e9 + 993;
const int maxn = 1e5 + 100;
int main() {
  cout.tie(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  vector<int> a(1002);
  bool is = false;
  for (int i = 0; i < s.size(); ++i) {
    if (i == 44 || i == 45 || i == 46) {
      i += 0;
    }
    string c;
    while (i < s.size() && s[i] != ',') {
      c += s[i++];
    }
    int t = 0;
    for (int j = 0; j < c.size(); ++j) {
      t *= 10;
      t += (c[j] - '0');
    }
    a[t] = 1;
  }
  int l, r;
  vector<pair<int, int>> ans;
  for (int i = 1; i <= 1001; ++i) {
    if (a[i]) {
      if (!is) {
        is = true;
        l = r = i;
      } else {
        r = i;
      }
    } else {
      if (is) {
        is = false;
        ans.push_back(make_pair(l, r));
      }
    }
  }
  for (int i = 0; i < ans.size(); ++i) {
    if (ans[i].first == ans[i].second) {
      cout << ans[i].first;
    } else {
      cout << ans[i].first << '-' << ans[i].second;
    }
    if (i != ans.size() - 1) {
      cout << ',';
    }
  }
  cerr << "\n\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
