Count number of words in string - MATLAB Cody - MATLAB Central

Problem 2802. Count number of words in string

Difficulty:Rate

Count number of words in string

Examples

 'hi', answer is 1
 'hi hi', answer is 2
 'I enjoy cody', answer is 3

Solution Stats

57.59% Correct | 42.41% Incorrect
Last Solution submitted on Sep 19, 2025

Problem Comments

Solution Comments

Show comments
AI Is Transforming Engineering Workflows
It’s an honor to deliver the keynote at MATLAB EXPO 2025. I'll...
0
MATLAB EXPO 2025 Registration is Now Open! November 12 – 13, 2025
Registration is now open for MathWorks annual virtual event MATLAB EXPO 2025...
0

Problem Recent Solvers182

Suggested Problems

More from this Author70

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!