#include <bits/stdc++.h>
using namespace std;
set<int> split(string s) {
  set<int> ret;
  int cur = 0, n = s.size();
  for (int i = 0; i < n; ++i) {
    if (s[i] == ',') {
      ret.insert(cur);
      cur = 0;
      continue;
    }
    cur = cur * 10 + s[i] - '0';
  }
  if (cur != 0) ret.insert(cur);
  return ret;
}
int main() {
  string s;
  cin >> s;
  set<int> st = split(s);
  int curStart = -1, curEnd = -1, prev = -1;
  vector<pair<int, int>> v;
  for (int x : st) {
    if (curStart == -1) {
      curStart = curEnd = prev = x;
      continue;
    }
    if (x == prev + 1) {
      ++curEnd;
      ++prev;
    } else {
      v.push_back({curStart, curEnd});
      curStart = curEnd = prev = x;
      continue;
    }
  }
  if (curStart != -1) v.push_back({curStart, curEnd});
  int n = v.size();
  for (int i = 0; i < n; ++i) {
    pair<int, int> x = v[i];
    if (x.first == x.second)
      cout << x.first;
    else
      cout << x.first << '-' << x.second;
    cout << ",\n"[i + 1 == n];
  }
}
