Decoding String
Many simple encoding methods have been devised over the years. A common method is the ASCII character set used to display characters on the screen. Each character is given a numeric value which can be interpreted by the computer.
To decode the string, first reverse the string of digits, then successively pick valid values from the string and convert them to their ASCII equivalents. Some of the values will have two digits, and others three. Use the ranges of valid values when decoding the string of digits.
Given a string, decode it following the steps mentioned above.
Complete the function decode.
decode has the following parameter(s):
string encode: an encoded stringReturn
string: the original decoded string decode.
1Example 1
Constraints
Limits and guarantees your solution can rely on.
1 <= |s| <= 105 s[i]is an ascii character in the range [A-Z a-z] or a space character