Java String Replace First Occurrence Leetcode Problem 543