重复字符居然不让放
呃,永远只有80分,看不懂哪扣分了,求同学们的帮助!
#include<bits/stdc++.h>
using namespace std;
int n,i,sum=1,cf,al,ks,js;
bool flag=0;
int main(){
char a[300]={};
string d;
while(cin.get(a[al])){
if(a[al]=='\n')break;
al++;
}
lable:
for(int j=1;j<=al;j++){
if(a[j]==a[j-1]){sum++;ks=j-1;cf=a[j]-32;}
else if(a[j]!=a[j-1]&&sum!=1){
//cout<<111<<endl;
js=j-1;
d="";
for(int q=js+1;q<al;q++){
d.push_back(a[q]);
}
d.push_back(cf);
d+=to_string(sum);
for(int q=0;q<ks;q++){
d.push_back(a[q]);
}
al=al-sum+2;
d.erase(al);
//cout<<d<<endl;
for(int q=0;q<d.size();q++){
a[q]=d[q];
}
cout<<d<<endl;
sum=1;
flag=1;
goto lable;
}
}
if(flag==1)cout<<d;
else cout<<a;
return 0;
}
```