没有附上详细题目
具体链接见:
link
我的代码:
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
string str;
int main() {
freopen(R"(C:\Users\VVUNVV\Desktop\ClionCodes\in.txt)", "r", stdin);
freopen(R"(C:\Users\VVUNVV\Desktop\ClionCodes\out.txt)", "w", stdout);
getline(cin, str);
int boy = 0, girl = 0;
int idx = 0;
while (idx < str.size())
{
switch (str[idx])
{
case 'b':
boy++;
if (str[idx + 1] != 'o')
idx++;
else if (str[idx + 2] != 'y')