2020-08-05 17:40:29 +00:00
|
|
|
// R36448319
|
|
|
|
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
2021-11-19 09:01:13 +00:00
|
|
|
int n, c; // n: 题意中的N, c: count
|
|
|
|
char l; // 上一个出现的字符
|
|
|
|
string s[205]; // 数组
|
2020-08-05 17:40:29 +00:00
|
|
|
|
|
|
|
n = c = 0;
|
|
|
|
l = '0';
|
|
|
|
|
|
|
|
cin >> s[0];
|
|
|
|
n = s[0].size();
|
2021-11-19 09:01:13 +00:00
|
|
|
for (int i = 1; i < n; i++) {
|
2020-08-05 17:40:29 +00:00
|
|
|
cin >> s[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << n << " ";
|
|
|
|
|
2021-11-19 09:01:13 +00:00
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
for (int j = 0; j < n; j++) {
|
|
|
|
if (s[i][j] == l) {
|
2020-08-05 17:40:29 +00:00
|
|
|
c++;
|
|
|
|
} else {
|
2021-11-19 09:01:13 +00:00
|
|
|
cout << c << " "; // 输出以前统计完的
|
|
|
|
c = 1; // 坑点: 这里一定要赋值为1, 因为当前字符也算
|
|
|
|
l = s[i][j]; // 设置当前字符为继续统计对象
|
2020-08-05 17:40:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-11-19 09:01:13 +00:00
|
|
|
cout << c << endl; // 坑点: 要输出最后一个统计
|
2020-08-05 17:40:29 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|