#include <bits/stdc++.h>
using namespace std;
int vis[10000000];
string tostring(int x) {
  stringstream ss;
  ss << x;
  string s;
  ss >> s;
  return s;
}
int main() {
  string x;
  cin >> x;
  int val = 0;
  for (int i = 0; i <= x.size(); i++) {
    if (isdigit(x[i])) {
      val += (x[i] - '0');
      val *= 10;
    } else {
      val /= 10;
      vis[val] = 1;
      val = 0;
    }
  }
  int l = -1, r = -1;
  string result = "";
  for (int i = 0; i < 1000000; i++) {
    if (vis[i] == 1) {
      if (vis[i - 1] == 0) {
        l = i;
        r = i;
      } else {
        r = r + 1;
      }
    } else {
      if (r != -1) {
        if (l == r) {
          result += tostring(l) + ',';
          r = -1;
        } else {
          result += tostring(l) + '-' + tostring(r) + ',';
          r = -1;
        }
      }
    }
  }
  result[result.size() - 1] = ' ';
  cout << result << endl;
  return 0;
}
