#include <bits/stdc++.h>
using namespace std;
int a[110], n = 0, res[1010], ch = 0, k = 0;
string s;
int main() {
  cin >> s;
  memset(a, 0, sizeof a);
  memset(res, 0, sizeof res);
  for (int i = 0; i < (int)s.length(); ++i)
    if (s[i] != ',') {
      a[n] *= 10;
      a[n] += (int)(s[i] - '0');
    } else
      ++n;
  ++n;
  for (int i = 0; i < n; ++i) res[a[i]] = 1;
  for (int i = 0; i < 1010; ++i) {
    if (res[i] == 1)
      ++ch;
    else {
      if (k > 0 && ch) cout << ',';
      if (ch && k == 0) ++k;
      if (ch == 1)
        cout << i - 1;
      else if (ch)
        cout << i - ch << '-' << i - 1;
      ch = 0;
    }
  }
  return 0;
}
