12
0
Given a string of unsorted alphanumeric characters, e.g.
ABC321STPpJqZZr0
output a ", "-separated list of character ranges, sorted by ASCII value, ignoring case and removing duplicates (i.e. outputting only uppercase and numeric characters), e.g.
0-3, A-C, J, P-T, Z
Rules
- The length of your program is your base score, as usual.
- You must initialize (hardcode) the above example within your program, but you may discount the length of that example from your program length, e.g. for
char* s="ABC321STPpJqZZr0";
you may discount 16 chars, the other 11 chars counting toward your program length.
Bonus (+50 bounty)
- As this was a real problem encountered by my coworker today, needing to be written in Tcl 8.0.5 (an ancient version, lacking many of the latest Tcl built-ins), I'll award 50 points to whomever writes the shortest Tcl 8.0.5 solution, if there are at least 2 valid submissions in Tcl 8.0.5.
@FezVrasta - I intentionally wrote
", "
to include the space, but we can leave your edit and let this comment serve as that indication. – Andrew Cheong – 2014-02-11T00:19:43.040Why intentionally include GolfScript? Why not allow other languages, such as Befunge? – Justin – 2014-02-11T01:14:11.053
We can say all is fair game. I just won't be able to check most of them very easily. – Andrew Cheong – 2014-02-11T01:15:15.797
So is that a Code-Golf tag then? – VisioN – 2014-02-11T08:35:30.497
1@Chron - Good catch. A-B in my case but since there have already been many submissions, let's allow both ways. – Andrew Cheong – 2014-02-11T09:21:47.673