Encode and Decode Strings - Leetcode 271