Home / Challenges / Count Words in Text

Count Words in Text

Medium
Write a function count_words(text) that takes a multi-line string (simulating file content) and returns the total number of words across all lines.

Input

A multi-line string.

Output

An integer total word count.

Example

Input
"Hello world\nThis is Python\nGoodbye"
Output
6
10 XP on solve Back to lesson

Your Solution

Output
Click "Run" to execute your code...

Log in to submit your solution and earn XP.