LC: Encode and Decode Strings - spiralgo/algorithms GitHub Wiki
The Essence:
The important things here is the communication of the two systems at the encoding and decoding ends. The source system needs to encode the strings in such a way that the receiving system can decode the message. The decoding should be without confusing any string with each other (for example seeing two strings as one) or distorting the data of a string.
The most intuitive way of achieving this is by placing delimiters between The decoding system should then separate the code into individual strings with the consideration of the delimiter.
Details:
Since ASCII characters can be used in the strings, using characters like '#' is not directly possible. There ways of getting around this.
Since this is a rather open design problem, there are many approaches to it. Three of these and their code can be found here: https://github.com/spiralgo/algorithms/pull/350