CJCoding With Joseph
15free / daySign inCreate account

Wordiest Line

Input: three lines of text, no prompt. Write them to lines.txt one per line, then read the file back and find the line with the most words, splitting each line on whitespace with split() after removing its newline with rstrip; when two lines tie, keep the earlier one. Print <line> (<n> words) with the winning line and its word count.

Expected Output:

one two three four (4 words)

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Files
📥 Auto-Input:
a b c\nhello world\none two three four\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.