社区讨论
Compile Error了
B2123字符串 p 型编码参与者 4已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @mi0vhnhl
- 此快照首次捕获于
- 2025/11/16 06:43 4 个月前
- 此快照最后确认于
- 2025/11/16 13:39 4 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
string str;
int t;
int main(){
cin>>str;
char ch=str[0];
for(int i=0;i<str.size();i++)
{
if(str[i]!=ch){ch=str[i];}
string s=substr(1,i+1);
if(s.find(ch,i)!=-1)
{
t++;
}
else cout<<t<<ch;
}
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...