VBScript 181181 109
About half of the length comes from sorting. Anyone have a better wayUpdated to do that in VBS?use a completely different algorithm. Beats JavaScript!
Pretty:
i=inputbox(""):o="":l=len(i)
dim ab(25699)
for x=1 TO l
v=asc(ucase(mid:i=ucase(i,x,1)))
ainputbox(vk)=a(V)+1
next
for z=0 to 1 step -1
for y=65 toy=65to 9190
IF z=ac=chr(y) THEN
o=o+chra=len(yreplace(i,c,k)
END IF)
nextb(a)=c+b(a)
next
msgbox ojoin(b,k)
Golfed:
i=inputboxdim b(""99):o="":l=leni=ucase(i):dim ainputbox(256k)):for x=1 TOy=65to l90:v=ascc=chr(ucasey):a=len(midreplace(i,xc,1)k)):ab(va)=a=c+b(Va)+1:next:for z=l to 1 step -1:for y=65 to 91:IFmsgbox z=a(y)THEN:o=o+chrjoin(yb,k):END IF:next:next:msgbox o