#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
bool vis[1111];
int main() {
  string s;
  cin >> s;
  s += ",";
  string tmp = "";
  for (int i = 0; i < (int)(s).size(); i++) {
    if (s[i] == ',') {
      int val = 0;
      for (int j = 0; j < (int)(tmp).size(); j++)
        val *= 10, val += (tmp[j] - '0');
      vis[val] = true;
      tmp = "";
    } else
      tmp += s[i];
  }
  bool pr = false;
  for (int i = 0; i < 1111; i++) {
    if (vis[i]) {
      int l = i;
      i++;
      while (vis[i]) i++;
      int r = i - 1;
      if (pr) {
        printf(",");
      }
      pr = true;
      if (l == r)
        printf("%d", l);
      else
        printf("%d-%d", l, r);
    }
  }
  return 0;
}
