20pts求调
查看原帖
20pts求调
1511943
Doraeman楼主2024/12/14 13:54
#include<bits/stdc++.h>
using namespace std;
const int N = 205;
int n, cnt, x, a[N*N], t; string s;
int main(){
    while(cin >> s){
        n = s.size(); t++;
        for(int i=0; i<n; i++)
        	a[++cnt] = s[i];
        if(t == n) break;
    }
    cout << n << ' ';
	for(int i=1; i<=cnt; i++){
		if(a[i] != a[i-1] && x){
			cout << x << ' ';
			x = 0;
		}
		x++;
	}
	cout << x;
}

试了很多输入都对了,为什么只有20pts

2024/12/14 13:54
加载中...