Visual Studio C++本地是对的,可洛谷他只有20分。
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string str, t;
int cnt = 0;
while (cin >> t)
{
str += (t);
cnt++;
}
cout << cnt << ' ';
cnt = 0;
char ch = str[0];
for (auto i = str.begin() + 1; i != str.end(); i++)
{
cnt++;
if (i != str.end())
if((*i)!=ch)
{
cout << cnt << ' ';
cnt = 0;
ch = *i;
}
}
cout << cnt + 1;
return 0;
}