String Encode And Decode Leetcode Problems Python