Design an algorithm to encode **a list of strings** to **a string**. The encoded string is then sent over the network and is decoded back to the original list of strings.
Please implement `encode` and `decode`.
**Note:** The string may contain any possible characters out of 256 valid ASCII characters. Your algorithm should be generalized enough to work on any possible characters.
Examples
Example 1
Input:
dummy_input = ["Hello","World"]Output:
["Hello","World"]Machine 1:
Codec encoder = new Codec();
String encodedString = encoder.encode(strs);
Machine 2:
Codec decoder = new Codec();
String[] strs = decoder.decode(encodedString);
Example 2
Input:
dummy_input = [""]Output:
[""]Constraints
- •
1 <= strs.length <= 200 - •
0 <= strs[i].length <= 200 - •
strs[i] contains any possible characters out of 256 ASCII characters.
Code Editor