#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<double, long long int> a, pair<double, long long int> b) {
  if (a.first > b.first)
    return true;
  else if (a.first == b.first) {
    if (a.second < b.second) return true;
  }
  return false;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}
bool isPowerOfTwo(int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
void solve() {
  set<long long int> s;
  long long int n = 0;
  string str;
  cin >> str;
  for (auto it : str) {
    if (it != ',')
      n = n * 10 + (it - '0');
    else {
      s.insert(n);
      n = 0;
    }
  }
  s.insert(n);
  vector<long long int> v;
  for (auto it : s) v.push_back(it);
  vector<long long int> temp;
  temp.push_back(v[0]);
  for (long long int i = 1; i < v.size(); i++) {
    if (v[i] - v[i - 1] == 1)
      temp.push_back(v[i]);
    else {
      if (temp.size() == 1)
        cout << temp[0] << ',';
      else
        cout << temp[0] << '-' << temp[temp.size() - 1] << ',';
      temp.erase(temp.begin(), temp.end());
      temp.push_back(v[i]);
    }
  }
  if (temp.size() != 0) {
    if (temp.size() == 1)
      cout << temp[0];
    else
      cout << temp[0] << '-' << temp[temp.size() - 1];
    temp.erase(temp.begin(), temp.end());
  }
}
int main() {
  solve();
  return 0;
}
