def x(s): n = list(map(int, s.split(','))) n.sort() a = [] b = n[0] k = n[0] for i in range(1, len(n)): if n[i] == n[i - 1]: continue if n[i] == n[i - 1] + 1: k = n[i] else: if b == k: a.append(str(b)) else: a.append(f"{b}-{k}") b = k = n[i] if b == k: a.append(str(b)) else: a.append(f"{b}-{k}") kq = ",".join(a) return kq s = input() print(x(s))