<job>
<script language=JScript runat=server>
function Descending(a, b) {
return ((b > a) ? 1 : ((b < a) ? -1 : 0));
}
function SortVBArray(arrVBArray) {
return arrVBArray.toArray().sort(Descending).join('@');
}
</script>
<script language=VBScript>
Function SortArray(arrInput)
SortArray = Split(SortVBArray(arrInput), "@")
End Function
Set Count = CreateObject("Scripting.Dictionary")
Blob = WScript.StdIn.ReadAll
Lines = Split(Blob, vbCrLf)
For Each L in Lines
Line = Trim(LCase(L))
For B = 1 To Len(Line)
C = Asc(Mid(Line, B, 1))
If C <> Asc(" ") And (C < Asc("a") Or C > Asc("z")) Then
'WSCript.Echo(Line)
'WScript.Echo(String(B-1, " ") & "^")
Line = Left(Line, B-1) & " " & Mid(Line, B+1)
'WSCript.Echo(Line)
'WScript.Echo(String(B-1, " ") & "^")
End If
Next
Words = Split(Line, " ")
For Each Word in Words
If Word <> " " And Word <> "" Then
If Count.Exists(Word) Then
Count.Item(Word) = Count.Item(Word) + 1
Else
Count.Item(Word) = 1
End If
End If
Next
Next
K = Count.Keys
Redim Lines(Count.Count-1)
For A = 0 To Count.Count-1
N = CStr(Count.Item(K(A)))
If Len(N) < 7 Then N = String(7-Len(N), " ") & N
Lines(A) = N & Chr(9) & K(A)
Next
SortedLines = SortArray(Lines)
For A = LBound(SortedLines) To UBound(SortedLines)
WScript.Echo(SortedLines(A))
Next
</script>
</job>