Anonymous user
Letter frequency: Difference between revisions
m
→{{header|Nanoquery}}
mNo edit summary |
|||
Line 1,874:
=={{header|Nanoquery}}==
<lang Nanoquery>// define a list to hold characters and amounts
// define the alphabet as a string to check only letters and numbers
// get the filename as an argument
// read the entire file into a string
// loop through all the characters in the array
for
// get the character to check
// check if the current character is in the array
if ((
// if it's there, increment its amount
else
if (
// if it's not, add it
append
append
end
end if
end for
// output the amounts
println format("%-20s %s", "Character", "Amount")
println "=" * 30
for
println format("%-20s %d",
end for</lang>
{{out}}
|