calculate word length