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

 

abraskin@mbusd.org 2019_units1-4_practice > replaceFirst
prev  |  next  |  chance

Given a String return the same String but with each occurrence of the first character replaced by the second character unless they are the same and then return "oops" instead.


Also return "oops" if the String is less than two characters long.

replaceFirst("abbracadabbra") → "bbbrbcbdbbbrb"
replaceFirst("a") → "oops"
replaceFirst("aa") → "oops"

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

public String replaceFirst(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: 200

Copyright Nick Parlante 2017 - privacy