Skip to content
Tcl Source Code Artifact [f0dec4af5b]
Login

Artifact [f0dec4af5b]

Artifact f0dec4af5b532b11734b82f5e91976782321aea8:


def wordsplit(line)
    list = []
    word = ""
    line.split('').each do |c|
	if c =~ /\s/
	    if word.length > 0
		list << word
	    end
	    word = ""
	else
	    word += c
	end
    end
    if word.length > 0
	list << word
    end
    return list
end

n = 0
while line = gets()
    words = wordsplit(line)
    n += words.length
end
printf("%d\n", n)