Typed Out String Leetcode Problems Javascript