不会的看我!!!
2023-12-02 12:05:38
发布于:广东
5阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int n,a[10001],minn=10001;
string s;
int cnt_c,cnt_p,cnt_d;
int main()
{
cin>>s;
int len = s.size();
for(auto i:s)
{
if(i=='c') cnt_c++;
else if(i=='p') cnt_p++;
else if(i=='d') cnt_d++;
}
if(cnt_c<minn) minn = cnt_c;
if(cnt_p<minn) minn = cnt_p;
if(cnt_d/2<minn) minn = cnt_d/2;
cout<<minn;
return 0;
}
这里空空如也
有帮助,赞一个