Java Replace First Occurrence Leetcode 753