# This is the wordcount program in meme
# NOTE: slightly braindead because we cannot tell if there is
# a newline on the last line or not.

# Right now no file io, so read from stdin
define line
define lines
define words
define chars
define ws

# these are globals so they are not created each time
# since we don't have statics or constants yet
ws = "abcdefghijklmnopqrstuvwxyz"
ws = ws + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ws = ws + "01234567890";

line = readline()
lines = 0
words = 0
chars = 0
while( line != null)
{
	lines = lines + 1
	chars = chars + len(line) + 1 # 1 is for newline
	words = words + count_words(  line )
	line = readline()
}

print "Lines: " + lines
print "Words: "  + words
print "Chars: " + chars

define word_char method(c)
{
	for w in ws
	{
		if( w == c )
			return 1
	}
	return 0
}

define count_words method(line)
{
	define nwords 0
	define max len(line)
	define inside 0

	for i in range(0,max-1)
	{
		define c
		define wc
		c = substr(line,i,1) 
		wc = word_char(c)
		
		if( not inside and wc )
			nwords = nwords + 1
		inside = wc
	}
	return nwords
}