Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Letter-frequency/VBScript/letter-frequency.vb
Normal file
24
Task/Letter-frequency/VBScript/letter-frequency.vb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
filepath = "SPECIFY FILE PATH HERE"
|
||||
|
||||
Set objfso = CreateObject("Scripting.FileSystemObject")
|
||||
Set objdict = CreateObject("Scripting.Dictionary")
|
||||
Set objfile = objfso.OpenTextFile(filepath,1)
|
||||
|
||||
txt = objfile.ReadAll
|
||||
|
||||
For i = 1 To Len(txt)
|
||||
char = Mid(txt,i,1)
|
||||
If objdict.Exists(char) Then
|
||||
objdict.Item(char) = objdict.Item(char) + 1
|
||||
Else
|
||||
objdict.Add char,1
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each key In objdict.Keys
|
||||
WScript.StdOut.WriteLine key & " = " & objdict.Item(key)
|
||||
Next
|
||||
|
||||
objfile.Close
|
||||
Set objfso = Nothing
|
||||
Set objdict = Nothing
|
||||
Loading…
Add table
Add a link
Reference in a new issue