Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (19 sloc) 0.573 kb
fs = require 'fs'
String::isAlphabetical = ->
return true if @length < 2
for i in [1..(@length - 1)]
return false if @[i] < @[i - 1]
return true
fs.readFile 'words.txt', (err, data) ->
if err
console.error 'Cannot open words.txt.'
process.exit 1
words = data.toString('ascii').split('\n')
alphacount = 0
for word in words
word = word.trim()
if word.length and word.isAlphabetical()
console.log word
console.log ''
console.log "#{alphacount} are alphabetical out of #{words.length} (#{(alphacount / words.length) * 100} percent)"
Jump to Line
Something went wrong with that request. Please try again.