#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
int x;
char c;
int a[1010];
int main() {
  cin >> x;
  a[x] = 1;
  while (cin >> c) {
    cin >> x;
    a[x] = 1;
  }
  int j = 0;
  while (j <= 1002) {
    if (a[j] == 1)
      if (a[j + 1] == 1) {
        int k = j + 1;
        while (a[k] == 1) k++;
        k--;
        ans.push_back(make_pair(j, k));
        j = k + 1;
      } else
        ans.push_back(make_pair(j, -1));
    j++;
  }
  if (ans[0].second == -1)
    cout << ans[0].first;
  else
    cout << ans[0].first << '-' << ans[0].second;
  for (int i = 1; i <= int(ans.size()) - 1; i++)
    if (ans[i].second == -1)
      cout << ',' << ans[i].first;
    else
      cout << ',' << ans[i].first << '-' << ans[i].second;
  return 0;
}
