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

 

dsawyer@methacton.org string_packet_level_2 > secondWord
prev  |  next  |  chance

Given a string that contains at least one space, return the second "word" in the string. If there is only one space, return all the characters that follow the space; otherwise return the characters between the first and second space. If the first two spaces are next to each other, an empty string is returned.


secondWord("a red ball") → "red"
secondWord("brown cow") → "cow"
secondWord("a b c d e") → "b"

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

public String secondWord( String s ){ }

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: 120

Copyright Nick Parlante 2017 - privacy