而且WA:提供的信息是把我输出的数n读为n+1了???
以下是源码:```cpp
#include
using namespace std;
int a[20005];
int main() {
int n = 0;
char t = '0';
char last = '0';
int p = 1;
int N = 0;
while (1) {
t = getchar();
if (t == '\n') {
n = N;
break;
}
if (t == last) {
a[p]++;
} else {
a[++p]++;
last = t;
}
N++;
}
for (int i = 1; i <= (n - 1) * (n + 1); i++) {
t = getchar();
if (t == '\n') {
continue;
}
if (t == last) {
a[p]++;
} else {
a[++p]++;
last = t;
}
}
cout << n << " ";
for (int i = 1; i <= p; i++) {
cout << a[i] << " ";
}
}