Skip to main content
deleted 192 characters in body
Source Link

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

VBScript 181

About half of the length comes from sorting. Anyone have a better way to do that in VBS?

Pretty:

i=inputbox(""):o="":l=len(i)
dim a(256)
for x=1 TO l
  v=asc(ucase(mid(i,x,1)))
  a(v)=a(V)+1
next
for z=0 to 1 step -1
    for y=65 to 91
        IF z=a(y) THEN
            o=o+chr(y)
        END IF
    next
next
msgbox o

Golfed:

i=inputbox(""):o="":l=len(i):dim a(256):for x=1 TO l:v=asc(ucase(mid(i,x,1))):a(v)=a(V)+1:next:for z=l to 1 step -1:for y=65 to 91:IF z=a(y)THEN:o=o+chr(y):END IF:next:next:msgbox o

VBScript 181 109

Updated to use a completely different algorithm. Beats JavaScript!

Pretty:

dim b(99):i=ucase(inputbox(k))
for y=65to 90
    c=chr(y)
    a=len(replace(i,c,k))
    b(a)=c+b(a)
next
msgbox join(b,k)

Golfed:

dim b(99):i=ucase(inputbox(k)):for y=65to 90:c=chr(y):a=len(replace(i,c,k)):b(a)=c+b(a):next:msgbox join(b,k)
edited body
Source Link

VBScript 181

About half of the length comes from sorting. Anyone have a better way to do that in VBS?

Pretty:

i=inputbox(""):o="":l=len(i)
dim a(256)
for x=1 TO l
  v=asc(ucase(mid(i,x,1)))
  a(v)=a(V)+1
next
for z=lz=0 to 1 step -1
    for y=65 to 91
        IF z=a(y) THEN
            o=o+chr(y)
        END IF
    next
next
msgbox o

Golfed:

i=inputbox(""):o="":l=len(i):dim a(256):for x=1 TO l:v=asc(ucase(mid(i,x,1))):a(v)=a(V)+1:next:for z=l to 1 step -1:for y=65 to 91:IF z=a(y)THEN:o=o+chr(y):END IF:next:next:msgbox o

VBScript 181

About half of the length comes from sorting. Anyone have a better way to do that in VBS?

Pretty:

i=inputbox(""):o="":l=len(i)
dim a(256)
for x=1 TO l
  v=asc(ucase(mid(i,x,1)))
  a(v)=a(V)+1
next
for z=l to 1 step -1
    for y=65 to 91
        IF z=a(y) THEN
            o=o+chr(y)
        END IF
    next
next
msgbox o

Golfed:

i=inputbox(""):o="":l=len(i):dim a(256):for x=1 TO l:v=asc(ucase(mid(i,x,1))):a(v)=a(V)+1:next:for z=l to 1 step -1:for y=65 to 91:IF z=a(y)THEN:o=o+chr(y):END IF:next:next:msgbox o

VBScript 181

About half of the length comes from sorting. Anyone have a better way to do that in VBS?

Pretty:

i=inputbox(""):o="":l=len(i)
dim a(256)
for x=1 TO l
  v=asc(ucase(mid(i,x,1)))
  a(v)=a(V)+1
next
for z=0 to 1 step -1
    for y=65 to 91
        IF z=a(y) THEN
            o=o+chr(y)
        END IF
    next
next
msgbox o

Golfed:

i=inputbox(""):o="":l=len(i):dim a(256):for x=1 TO l:v=asc(ucase(mid(i,x,1))):a(v)=a(V)+1:next:for z=l to 1 step -1:for y=65 to 91:IF z=a(y)THEN:o=o+chr(y):END IF:next:next:msgbox o
Source Link

VBScript 181

About half of the length comes from sorting. Anyone have a better way to do that in VBS?

Pretty:

i=inputbox(""):o="":l=len(i)
dim a(256)
for x=1 TO l
  v=asc(ucase(mid(i,x,1)))
  a(v)=a(V)+1
next
for z=l to 1 step -1
    for y=65 to 91
        IF z=a(y) THEN
            o=o+chr(y)
        END IF
    next
next
msgbox o

Golfed:

i=inputbox(""):o="":l=len(i):dim a(256):for x=1 TO l:v=asc(ucase(mid(i,x,1))):a(v)=a(V)+1:next:for z=l to 1 step -1:for y=65 to 91:IF z=a(y)THEN:o=o+chr(y):END IF:next:next:msgbox o