#include <bits/stdc++.h>
using namespace std;
char *opos, OutFile[65536], DIP[20];
FILE *pfile;
inline void InitFASTIO() { opos = OutFile; }
inline void FlushFASTIO() { fwrite(OutFile, opos - OutFile, 1, stdout); }
inline void fps(int &x) {
  register int c = getchar();
  x = 0;
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
}
inline void fs(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline void fl(long long int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline void pi(int x, int flag = 1) {
  int y, dig = 0;
  if (x < 0) {
    *opos++ = '-';
    x = -x;
  };
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
  while (x || !dig) {
    y = x / 10;
    DIP[dig++] = x - ((y << 3) + (y << 1)) + '0';
    x = y;
  }
  while (dig--) {
    *opos++ = DIP[dig];
    if (opos - OutFile == (sizeof(OutFile) - 1)) {
      FlushFASTIO();
      InitFASTIO();
    }
  }
  *opos++ = flag ? '\n' : ' ';
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
}
inline void pll(long long int x, int flag = 1) {
  long long int y, dig = 0;
  if (x < 0) {
    *opos++ = '-';
    x = -x;
  };
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
  while (x || !dig) {
    y = x / 10;
    DIP[dig++] = x - ((y << 3) + (y << 1)) + '0';
    x = y;
  }
  while (dig--) {
    *opos++ = DIP[dig];
    if (opos - OutFile == (sizeof(OutFile) - 1)) {
      FlushFASTIO();
      InitFASTIO();
    }
  }
  *opos++ = flag ? '\n' : ' ';
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
}
inline void ps(char *str, int flag = 1) {
  int len = strlen(str);
  for (int i = 0; i < len; i++) {
    *opos++ = str[i];
    if (opos - OutFile == (sizeof(OutFile) - 1)) {
      FlushFASTIO();
      InitFASTIO();
    }
  }
  *opos++ = flag ? '\n' : ' ';
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
}
inline void pws(int flag = 1) {
  *opos++ = flag ? '\n' : ' ';
  if (opos - OutFile == (sizeof(OutFile) - 1)) {
    FlushFASTIO();
    InitFASTIO();
  }
}
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
void sieve(vector<int> &prime, int size) {
  prime[0] = 1;
  prime[1] = 1;
  for (long long i = 2; i <= size; i++) {
    if (!prime[i]) {
      prime[i] = i;
      for (long long j = i; j * i <= size; j++) {
        if (!prime[j * i]) prime[j * i] = i;
      }
    }
  }
}
int toInt(char xx) { return xx - '0'; }
char toChar(int xx) { return xx + '0'; }
bool isDigit(char xx) { return ('0' <= xx && xx <= '9'); }
bool isCharacter(char xx) {
  return (('a' <= xx && xx <= 'z') || ('A' <= xx && xx <= 'Z'));
}
bool isUpper(char xx) { return ('A' <= xx && xx <= 'Z'); }
bool isLower(char xx) { return ('a' <= xx && xx <= 'z'); }
bool isPalin(string x) {
  int len = x.length();
  for (long long i = 0; i < len / 2; i++) {
    if (x[i] != x[len - 1 - i]) return false;
  }
  return true;
}
void swapInt(int &x, int &y) {
  x = x ^ y;
  y = x ^ y;
  x = x ^ y;
}
string tolowerStr(string x) {
  string ret = "";
  for (long long i = 0; i < x.length(); i++) {
    ret.push_back(tolower(x[i]));
  }
  return ret;
}
string toupperStr(string x) {
  string ret = "";
  for (long long i = 0; i < x.length(); i++) {
    ret.push_back(toupper(x[i]));
  }
  return ret;
}
void toCharArray(char *dest, string source) { strcpy(dest, source.c_str()); }
void split(vector<string> &s, string g, char c) {
  for (long long i = 0; i < g.length(); i++)
    if (g[i] == c) g[i] = ' ';
  stringstream in(g);
  for (string t; in >> t;) s.push_back(t);
}
void splitint(vector<int> &s, string g, char c) {
  for (long long i = 0; i < g.length(); i++)
    if (g[i] == c) g[i] = ' ';
  stringstream in(g);
  for (int t; in >> t;) s.push_back(t);
}
int main() {
  InitFASTIO();
  int uui;
  string s;
  cin >> s;
  vector<int> vi;
  splitint(vi, s, ',');
  int n = vi.size();
  sort(vi.begin(), vi.end());
  cout << vi[0];
  int count = 0;
  for (long long i = 1; i < n; i++) {
    if (vi[i] > vi[i - 1] + 1) {
      if (count == 0)
        cout << ',' << vi[i];
      else {
        cout << '-' << vi[i - 1] << ',' << vi[i];
        count = 0;
      }
    } else if (count && i == n - 1) {
      cout << '-' << vi[i];
    } else if (vi[i] == vi[i - 1] + 1)
      count = 1;
  }
  FlushFASTIO();
  return 0;
}
