mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 05:18:49 +00:00
P1321 单词覆盖还原
R38664427
This commit is contained in:
parent
cec58be09c
commit
69ab2a6cce
22
problem/P1321/P1321.cpp
Normal file
22
problem/P1321/P1321.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
// R38664427
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
int boy, girl;
|
||||
boy = girl = 0;
|
||||
cin >> s;
|
||||
|
||||
for (int i = 0; i < s.size() - 2; i++) {
|
||||
boy += (s[i] == 'b' || s[i + 1] == 'o' || s[i + 2] == 'y');
|
||||
}
|
||||
for (int i = 0; i < s.size() - 3; i++) {
|
||||
girl += (s[i] == 'g' || s[i + 1] == 'i' || s[i + 2] == 'r' || s[i + 3] == 'l');
|
||||
}
|
||||
|
||||
cout << boy << endl << girl << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user