โ Back to Arrays
Question 58
Word Count and Length Stats
Word Count and Length Stats
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
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.