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)