CJCoding With Joseph
15free / daySign inCreate account

Write a program that reads a line of text into a character array and reports three values: 1) The total number of words 2) The length of the longest word 3) The number of words with length 4 or more

The input may contain extra spaces at the beginning, at the end, or multiple spaces between words. A word is a sequence of non-space characters.

Output the results exactly in this format: Words: X Longest: Y AtLeast4: Z

Expected output

Words: 3
Longest: 4
AtLeast4: 1

= newline. No newline after the last line.

Hints4 available
Topics
Arrays
Auto-input
Dog Cat Fish \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 · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.