Encode and Decode Strings
Design an algorithm to encode a list of strings into a single string, and then decode that string back to the original list.
Implement two functions encode and decode:
encode(strs)takes a list of strings and returns a single encoded string.decode(s)takes the encoded string and returns the original list of strings.
Your encoding/decoding scheme must be unambiguous; i.e., decode(encode(strs)) must always return the exact original list, even with punctuation, spaces, or any UTF-8 characters.
Example 1:
Input: [\"codey\",\"love\",\"you\"] Output: [\"codey\",\"love\",\"you\"]
Example 2:
Input: [\"we\",\"say\",\":\",\"yes\"] Output: [\"we\",\"say\",\":\",\"yes\"]
Constraints:
0 <= strs.length < 1000 <= strs[i].length < 200strs[i]contains only UTF-8 characters.