问题标题: 远古帖,我要结掉,第一个回答的给豆豆

0
0
已解决
高驰宇
高驰宇
资深光能
资深光能

???

有没有人能够给出来更好的错误原因

#include <iostream>
using namespace std;
int str_len,maxn=-0x3f;
string s;
int t[200];              
int main(){
    cin>>str_len>>s;
	for(int i=0;i<=s.size();i++){
		if(s[i-1]==s[i]){
			t[s[i]]=t[s[i-1]]+1;
		}
		else{
			t[s[i]]=1;
		}
		maxn=max(t[s[i]],maxn);
	}
	for(int i=0;i<s.size();i++){
		if(maxn==t[s[i]]){
			cout<<s[i]<<" ";
			for(int j=i;j<s.size();j++){
				if(s[i]==s[j]){
					t[s[j]]=0;
				}
			}
		}
	}
	cout<<"\n"<<maxn;
    return 0;
}

 

高驰宇在2026-01-23 19:23:16追加了内容

我要结掉这个远古帖了,第一个回复的(不算我)给豆豆

高驰宇在2026-01-23 19:24:47追加了内容

RT


0
0
李净羽
李净羽
初级守护
初级守护

豆豆!!!!!!!!

0
0
我要回答