P1321 单词覆盖还原
#include<bits/stdc++.h>
using namespace std;
int boy, girl;//存放答案滴
string x;
//这道题太无聊了~
int main() {
cin >> x;
for (int i = 0; i < x.length(); i++) {
//boy
if (x[i] == 'b')boy++;
if (x[i] == 'o' && x[i - 1] != 'b')boy++;
if (x[i] == 'y' && x[i - 1] != 'o')boy++;
//girl
if (x[i] == 'g')girl++;
if (x[i] == 'i' && x[i - 1] != 'g')girl++;
if (x[i] == 'r' && x[i - 1] != 'i')girl++;
if (x[i] == 'l' && x[i - 1] != 'r')girl++;
}
printf("%d\n%d", boy, girl);
return 0;
}