You are given an array A of strings and we have to serialize it and return the serialized string.
Serialization: Scan each element in a string, calculate its length and append it with a string and a element separator or deliminator (the deliminator is ~). We append the length of the string so that we know the length of each element.
For example, for a string 'interviewbit', its serialized version would be 'interviewbit12~'.
A = ['scaler', 'academy']
A = ['interviewbit']
Length of 'scaler' is 6 and academy is 7. So, the resulting string is scaler6~academy7~.
Explained in the description above.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.