When a string is very long, it is often necessary to compress it and shorten it. In this problem, given a string, we write a program that compresses a sequence of substrings with the same alphabet and outputs a result. For example, suppose the string is AAABBBBBCCCCDDDDEFFFF. When this string is compressed, it is compressed by writing down how many times the character appears on the part where the same character appears consecutively. That is, this string is compressed into 3A5B4C4DE3F. Since there is only one E, you do not write down one separately.
The first line is given the string to be compressed. The length of the string is less than 1000. The alphabets constructed in the string are uppercase.
This code is
That's it. I have to print out the last letter, but it doesn't work. Help mestring python
There is a problem with the code, but you can also write it as it is. You can calculate it by adding one character that you can't "never" come after the character you want to calculate.
© 2022 pinfo. All rights reserved.