C++
#include <iostream> using namespace std; int main() { string wl; cin >> wl; int w11=0, l11=0; for (auto i:wl) { if (i=='W') w11+=1; else l11+=1; if (w11>=11&&w11-l11>=2 || l11>=11&&l11-w11>=2) { cout << w11 << ':' << l11 <<endl; w11=0; l11=0; } } cout << w11 << ':' << l11 << endl << endl; int w21=0, l21=0; for (auto i:wl) { if (i=='W') w21+=1; else l21+=1; if (w21>=21&&w21-l21>=2 || l21>=21&&l21-w21>=2) { cout << w21 << ':' << l21 <<endl; w21=0; l21=0; } } cout << w21 << ':' << l21 <<endl; } // 64 位输出请用 printf("%lld")