Implement to_ranges(nums) that sorts and de-duplicates integers, then formats runs of consecutive numbers as start-end (two or more numbers) or a single number, joined by commas:
[5, 1, 2, 3, 7, 8, 10] → "1-3,5,7-8,10"
Also implement the inverse from_ranges(text) returning a sorted list of ints (an empty string gives []).