Four-legged cat: enter a string of lowercase letters on the keyboard (~ Z. Compile a character string compression program to compress duplicate letters in the character string and output the compressed character string. Compression rules: (1) only compress the repeated characters. For example, the string "abcbc" has no consecutive duplicates.
Four-legged cat: enter a string of lowercase letters on the keyboard (~ Z. Compile a character string compression program to compress duplicate letters in the character string and output the compressed character string. Compression rules: (1) only compress repeated characters. For example, the string "abcbc" has no consecutive duplicates.
Four-legged cat: enter a string of lowercase letters on the keyboard (~ Z. Compile a string compression program,
Compress duplicate letters in the string and output the compressed string.
Compression rules:
(1) only compress the repeated characters. For example, the compressed string "abcbc" is still "abcbc" because there are no consecutive repeated characters ".
(2) The format of the compressed field is "character + number of repeated characters ". For example, the string "xxxyyyyyyz" becomes "x3y6z" after compression ".
(3) do not compress a single character. For example, "abc", after compression or "abc ". <无>
"; $ Str = str_compress ($ str); echo $ str; echo"
"; $ Str = str_compress ($ str, 0); echo $ str; echo"
"; If ($ str = $ old_str) {echo 1;} else {echo 0 ;}