Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local handle,content = fs.open(args[1],"r"),false
- content = handle.readAll()
- handle.close()
- local chars = {}
- for match in content:gmatch(".") do
- if(not chars[match]) then
- chars[match] = 1
- else
- chars[match] = chars[match]+1
- end
- end
- local sorted = {}
- for k,v in pairs(chars) do
- if(not sorted[v]) then
- sorted[v] = {k}
- else
- table.insert(sorted[v],k)
- end
- end
- handle = fs.open("output","w")
- handle.write(textutils.serialize(sorted))
- handle.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement