Huawei OD Machine Test - String Summary (Java & JS & Python)

topic description

Given a digest algorithm for a string, output the digest value for the given string

  1. Strip non-alphabetic symbols from a string.
  2. If consecutive characters (case-insensitive) appear, output: the character (lowercase) + the number of consecutive occurrences.
  3. If it is a non-consecutive character (case-insensitive), output: the character (lowercase) + the number of occurrences of the character in the string after the letter
  4. Sort the strings expressed in the above way: letters and numbers that follow are sorted as a group, with the larger numbers first, and those with the same number are sorted alphabetically, and the smaller letters first.

enter description

A line of strings with a length of [1,200]

output description

digest string

Example

enter aabbcc
output a2b2c2
illustrate none

Guess you like

Origin blog.csdn.net/qfc_128220/article/details/130769939