#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    int len = s.length();
    while (true) {
        bool flag = false;
        for (int i = 0; i < len; ) {
            int j = i + 1;
            while (j < len && s[j] == s[i]) j++;
            if (j - i > 1) {
                s.replace(i, j - i, string(1, toupper(s[i])) + to_string(j - i));
                len = s.length();
                flag = true;
            } else {
                i = j;
            }
        }
        if (!flag) break;
        reverse(s.begin(), s.end());
    }
    cout << s << endl;
    return 0;
}
``
请帮我用DEVC++553版本帮我写一个程序:对输入的一个由小写英文字母组成的字符串进行变换变换的规则是这样的:若连续出现相同的小写字母则将它们替换成这个字母的大写形式后面紧跟相同字母的个数并把它之前与之后的两段子字符串对调如出现 bmttttfu则新字符串变换为:fuT4bm然后重新扫描字串直到没有出现相同小写字母为止。

原文地址: https://www.cveoy.top/t/topic/c0As 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录