Clean_Breeze @ 2020-02-03 14:54:16
#include <iostream>
#include <cmath>
using namespace std;
int main(){
char n[40005]={0};
int ans[40005]={0},i=1,v=1;
while (cin >> n[i]){
/*cout << "n: " << n << " "
<< "i: " << i << " "
<< "v: " << v << " "
<< "ans[v]: " << ans[v] << " "
<< endl;*/
if(n[i] != n[i-1]) v++;
ans[v]++;
i++;
}
cout << sqrt(i-1)<< " ";
for(int j = 1;j <= v;j++)cout << ans[j] << " ";
return 0;
}
by liqingyang @ 2020-02-03 14:59:55
什么题?
by Clean_Breeze @ 2020-02-03 15:00:40
@liqingyang P1320