很easy的一道题哈 但我就是想写个题解😂
#include <cstdio>
#include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
string str;
getline(cin, str);
int cont = 0;
bool flag = false;
for(int i = 0,j = 0; i < str.size(); )
{
if(str[i] == '6')
{
int j = i,cont = 0;
while(str[j] == '6')
{
i++;
j++;
cont++;
}
if(cont <= 3)
{
while(cont--) cout << '6';
}
else if(cont > 9) cout << "27";
else if(cont > 3 ) cout << "9";
}
else
{
cout << str[i];
i++;
}
}
return 0;
}
去年暑假第一遍还不会写 现在就一遍过了 有感受到成长 就写个题解开心一下哈哈哈