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

 

norm.krumpe@muohio.edu homework8 > swapWords
prev  |  next  |  chance

Given a string containing two words separated by a comma, return a new string with the two words swapped. Each word will contain at least one letter. Note: A good first step would be to determine the location of the comma. Once you know its location, you can use it to grab the substrings on the left and right sides of that comma.


swapWords("cat,dog") → "dog,cat"
swapWords("house,boat") → "boat,house"
swapWords("a,bc") → "bc,a"

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

String swapWords(String words) { }

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

Copyright Nick Parlante 2017 - privacy