//#define LOCAL
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
#define inf 0x3f3f3f3f
#define eps 1e-6
using namespace std;
#define clr(x) memset(x,0,sizeof((x)))
const int maxn = 1e4+1;//2e6+1
#define MAX(a,b,c) ((a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c)))
#define _max(a,b) ((a) > (b) ? (a) : (b))
#define _min(a,b) ((a) < (b) ? (a) : (b))
#define _for(a,b,c) for(int a = b;a<c;a++)
int main()
{
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif
string s;
cin>>s;
int bn = 0,gn = 0;
unsigned int i;
for(i = 0;i<s.length();i++) {
if(s[i]=='b'||s[i+1]=='o'||s[i+2]=='y') {
bn++;
}
if(s[i]=='g'||s[i+1]=='i'||s[i+2]=='r'||s[i+3]=='l') {
gn++;
}
}
cout<<bn<<endl<<gn;
return 0;
}
洛谷 P1321 单词覆盖还原 题解 (字符串C/C++)
猜你喜欢
转载自blog.csdn.net/Jason__Jie/article/details/112757718
今日推荐
周排行