alphabet ranges

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Each line contains a row of letters. Compress substrings of 3 or more contiguous letters in to ranges using hyphens: "abcd" becomes "a-d". Lowercase and uppercase letters must be handled separately: "abcd....xyzABCD...XYZ" becomes "a-zA-Z".

(If you've ever played NetHack: this is how inventory prompts are done.)

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

fgijtABCDEFGHIJMNOX
abcdejpqrstuvwxyzABCDIJMN
abefghijklmnopqrstuvwxzHVWXY
defghijklmnoqvwxyzABCDEFGHIJKLMNOPQRSVWXZ
cdefghijzABCDEFNOPQRSTWXYZ
abcijnrBCDEFGHIJLMNOPQRSTUV
nopqrstuvEFGMNOPQRXYZ
defmnpqrstuvwxyDEOPQRSTUVWXY
mnoptuvwLMNOPQRSTU
pqrwxCDFGHIOPQYZ
abxyzABCEFGHIJKLOTUVWXYZ
adefhijklmnpqrvwxyzABCTUZ
aghijklmrsuvwEFGHIJKLQRSTUV
vwyDEFGHIJKLMNOPQRSTUVWYZ
anuvyzAEFGHIJQUVWXYZ
abdlmnopqruvTU
tNOPQRSTUVWX
abcdefghijklmnDERSTUVWXYZ
abcdefghijklmnstuvyzGHIJKLMQRSXYZ
abcdeflmnopqrvwIJKNOPQRSTUVWXYZ

Sample output:

fgijtA-JM-OX
a-ejp-zA-DIJMN
abe-xzHV-Y
d-oqv-zA-SV-XZ
c-jzA-FN-TW-Z
a-cijnrB-JL-V
n-vE-GM-RX-Z
d-fmnp-yDEO-Y
m-pt-wL-U
p-rwxCDF-IO-QYZ
abx-zA-CE-LOT-Z
ad-fh-np-rv-zA-CTUZ
ag-mrsu-wE-LQ-V
vwyD-WYZ
anuvyzAE-JQU-Z
abdl-ruvTU
tN-X
a-nDER-Z
a-ns-vyzG-MQ-SX-Z
a-fl-rvwI-KN-Z

Sample input:_

hijklmnouvxBMNOPQSTUVWXYZ
abcdefgstvwxyzACDEFGHINOPQRS
hijklmnopqrsxyzABCGHIJKLNOPWX
cdefghijklmxyzHIJKLMNOPQRUWX
efghilmnopEFGIJKLMNOPQRSTXYZ
abdefghijklmnopqvHLMNOPQTUVWX
cstwxyzABCDEFLPQRTXY
mnopqrsxyzABDEFIJKLMNOQRST
bcklmopqrstuvyzABCDEFGHIJTUV
abghijklmntuvwABCDEFGHKLMNZ
abcdefghijtuvEFGHKLMNOPQRSTVWXYZ
abcdijklmuvwxyzABCDEFGHRSVWXYZ
abcdeyzABCDEFGHIVWYZ
abcdefklmnopqWXY
adehijklmnopqrstuvwxyHIJKLMNOP
abcdefghinopqrstuvzABCDEFVWXYZ
abcdefghijkltuvwxyzCDHVWXYZ
acghijklmopquvwxzABCDN
fghijklmnopqrstuvBCDEHIJNZ
abcdefghijkNOPQRSTUVWXYZ

Sample output:

h-ouvxBM-QS-Z
a-gstv-zAC-IN-S
h-sx-zA-CG-LN-PWX
c-mx-zH-RUWX
e-il-pE-GI-TX-Z
abd-qvHL-QT-X
cstw-zA-FLP-RTXY
m-sx-zABD-FI-OQ-T
bck-mo-vyzA-JT-V
abg-nt-wA-HK-NZ
a-jt-vE-HK-TV-Z
a-di-mu-zA-HRSV-Z
a-eyzA-IVWYZ
a-fk-qW-Y
adeh-yH-P
a-in-vzA-FV-Z
a-lt-zCDHV-Z
acg-mo-qu-xzA-DN
f-vB-EH-JNZ
a-kN-Z

Sample input:_

ghijklmnopBCJVWXYZ
aqrstuvwxyzABCDEFGHINPQRXYZ
abglmnopqrstuvwxzABCDHIJKPZ
abcdijknopqrstuvwxyzABCDEFGHIJKLMNOPQRS
lquvMNPRSTUVWXYZ
acefghijklmnopqyzABCDKLPQRSTUV
bchvDFGHIJKLMNOPQRSTVWXYZ
abelmvwxyzABCDEFIS
klmnopqrsDESTUVW
defghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWXY
bcdefghijklmnopqrstuvwxyzABCDEFGHISTU
bcdefghijnovwxyzABCDEGHIJKLMNOPQRSTU
abcdefghijklmnopqrzAIJKLMNOWXYZ
bcijklopqrsvwxyzABCDMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyzJKPQRST
bcdeflmqrsBCDEFLMNOP
mnoxIJKLMNOPQXY
ghjklmnozABCDEFGHIJKLOPSTU
tuzABCDEFKLMNPQSTUVWXY
cdhijklmnopqrsQRS

Sample output:

g-pBCJV-Z
aq-zA-INP-RX-Z
abgl-xzA-DH-KPZ
a-di-kn-zA-S
lquvMNPR-Z
ace-qyzA-DKLP-V
bchvDF-TV-Z
abelmv-zA-FIS
k-sDES-W
d-zA-QW-Y
b-zA-IS-U
b-jnov-zA-EG-U
a-rzAI-OW-Z
bci-lo-sv-zA-DM-Z
a-zJKP-T
b-flmq-sB-FL-P
m-oxI-QXY
ghj-ozA-LOPS-U
tuzA-FK-NPQS-Y
cdh-sQ-S

Ranking

Perl _

RankUserSizeTimeDateStatistics
1tails650.04632011/05/02 14:42:050B / 21B / 40B
2llhuii(tails)570.04442016/01/07 21:39:590B / 17B / 38B

Python _

RankUserSizeTimeDateStatistics
1twobit1110.78622011/04/20 01:26:170B / 57B / 49B
2hallvabo1300.08202011/04/25 02:25:380B / 61B / 58B
3mitchs (llhuii(twobit))1050.17982015/10/20 12:43:020B / 60B / 40B
4llhuii(twobit)1062.13392015/10/20 00:03:390B / 60B / 44B

Scheme _

RankUserSizeTimeDateStatistics
1kaki850.18482011/04/24 06:24:270B / 40B / 44B
2dico_leque850.13222011/05/03 07:39:180B / 35B / 49B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima1370.20172011/05/03 15:38:020B / 57B / 70B
2youz1440.16412011/05/03 14:59:320B / 60B / 77B

JavaScript _

RankUserSizeTimeDateStatistics
10mg980.02462011/04/23 07:30:140B / 48B / 50B
2nn1200.04022011/04/30 20:39:350B / 60B / 60B

Lua _

RankUserSizeTimeDateStatistics
1twobit1160.04502011/04/20 01:31:490B / 66B / 39B

J _

RankUserSizeTimeDateStatistics
1I., S.490.09992011/10/22 23:01:220B / 11B / 38B

A+ _

RankUserSizeTimeDateStatistics
1twobit680.10512011/05/02 03:46:1914B / 32B / 20B

C _

RankUserSizeTimeDateStatistics
1twobit810.01882011/05/02 21:57:570B / 44B / 37B
2nn940.00252011/04/30 21:44:420B / 45B / 49B
3%20(twobit)750.02912016/01/07 17:32:410B / 39B / 36B
4%20 (twobit)750.01622016/01/07 17:51:160B / 39B / 36B

OCaml _

RankUserSizeTimeDateStatistics
1m.ukai1500.14442011/04/20 14:13:390B / 92B / 42B

Java _

RankUserSizeTimeDateStatistics
1nattow1920.41802011/04/28 17:33:520B / 99B / 88B

sed _

RankUserSizeTimeDateStatistics
1tails (%20)910.06122015/10/19 17:12:340B / 39B / 46B
2%20980.45972015/10/19 02:22:170B / 42B / 47B

Brainfuck _

RankUserSizeTimeDateStatistics
1twobit2230.17452011/05/02 21:32:200B / 0B / 223B
2mitchs900.05212015/10/19 16:02:540B / 0B / 90B

GolfScript _

RankUserSizeTimeDateStatistics
1twobit410.29412011/04/29 10:23:480B / 4B / 37B

Lazy-K _

RankUserSizeTimeDateStatistics
1irori5030.29912011/04/19 23:05:450B / 257B / 246B

Universal Lambda _

RankUserSizeTimeDateStatistics
1irori410.15122011/04/20 20:32:4827B / 8B / 6B

Groovy _

RankUserSizeTimeDateStatistics
1nn846.65562011/04/30 22:35:210B / 41B / 41B

Language Ranking_

RankLangUserSizeScore
1Universal Lambdairori4110000
2GolfScripttwobit4110000
3JI., S.498367
4Perlllhuii(tails)577192
5A+twobit686029
6C%20 (twobit)755466
7Groovynn844880
8Schemekaki854823
9Brainfuckmitchs904555
10sedtails (%20)914505
11JavaScript0mg984183
12Pythonmitchs (llhuii(twobit))1053904
13Luatwobit1163534
14Common LISPkozima1372992
15OCamlm.ukai1502733
16Javanattow1922135
17Lazy-Kirori503815

return top