Java String Replace First Occurrence Leetcode Problem 2002