cswork / OA打开练习工作台

Goldman SachsOA #7

Decoding String

估计简单评测数据准备中,可先阅读题面

考点(AI 标注)字符串

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. The value range for A through Z is 65 through 90. The value range from a through z is 97 through 122. The value of the space character is 32. Given a string, decode it following the steps mentioned above. Function Description Complete the function decode. decode has the following parameter(s): string encode: an encoded string Return string: the original decoded string decode.

Constraints

  • 1 ≤ |s| ≤ 10⁵
  • s[i]is an ascii character in the range [A-Z a-z] or a space character