Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133986 | 林扬泉 | 划分字母区间 | C++ | 通过 | 100 | 0 MS | 260 KB | 431 | 2024-03-02 11:11:25 |
#include<bits/stdc++.h> using namespace std; const int N=1e4+10; int t[N]; string s; int x; int main(){ cin>>s; int ma=0; for(int i=0;i<s.size();i++){ for(int j=i;j<s.size();j++){ if(s[j]==s[i]){ ma=max(ma,j); } } if(ma==i){ t[++x]=ma; } } for(int i=1;i<=x;i++){ if(i==1){ printf("%d ",t[i]+1); } else{ printf("%d ",t[i]-t[i-1]); } } printf("\n"); return 0; }