3 solutions

  • 0
    @ 2025-8-26 15:10:32
    
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	//freopen("char.in","r",stdin);
    	//freopen("char.out","w",stdout);
    	char a[100000],b;
    	int c,n,s=1,max1=0;
    	cin>>n;
    	for(int i=1;i<=n;i++){
    		cin>>a[i];
    		c=a[i];
    		if(c-int(a[i-1])==1){
    			s++; 
    		}
    		else{
                if(s>max1){
    			max1=s;
    		}
    			s=1;
    		}
    	}
    	cout<<max1;
    	return 0;
    }
    ```
    
    
    ```

    Information

    ID
    1031
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    79
    Accepted
    14
    Uploaded By