[Huawei OD Unified Exam B Paper | 100 points] Simple compression algorithm (C++ Java JavaScript Python)

Topic Simple Compression Algorithm

There is a simple compression algorithm: for a string composed of all lowercase English letters, compress the part with more than two consecutive identical letters into a continuous number plus the other part of the letter remains unchanged. For example, the string is compressed
into aaabbccccdcharacters string3abb4cd


Please write a decompression function to judge whether it is a legally compressed string according to the input string

  • If the input is legal, output the decompressed string
  • otherwise

Guess you like

Origin blog.csdn.net/shangyanaf/article/details/130926358