id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-loops > apcsaChatbotsCountWordsHard
prev  |  next  |  chance

HARDER PROBLEM: skip if you have trouble
Given an input String, find the number of words. For this problem, a word is defined very simply as any set of characters which are not spaces. The test cases for this problem include more "edge cases" with more unusual character sequences.

HINT: think about how many spaces there are in the input.

apcsaChatbotsCountWordsHard(" spacefirst") → 1
apcsaChatbotsCountWordsHard("spacelast ") → 1
apcsaChatbotsCountWordsHard("nospace") → 1

...Save, Compile, Run (ctrl-enter)

public int apcsaChatbotsCountWordsHard(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250

Copyright Nick Parlante 2017 - privacy