Design Leetcode Problems Javascript Substring Until Character