forked from rahul22mrk/hackoctoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CFMM
45 lines (42 loc) · 875 Bytes
/
CFMM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// https://www.codechef.com/problems/CFMM
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s[n];
int c=0,o=0,d=0,e=0,h=0,f=0;
for(int i=0;i<n;i++)
{
cin>>s[i];
}
for(int i=0;i<n;i++){
int a=s[i].size();
for(int j=0;j<a;j++){
if(s[i][j]=='c')
c++;
else if(s[i][j]=='o'){
o++;}
else if(s[i][j]=='d'){
d++;}
else if(s[i][j]=='e'){
e++;}
else if(s[i][j]=='c'){
c++;}
else if(s[i][j]=='h'){
h++;}
else if(s[i][j]=='e'){
e++;}
else if(s[i][j]=='f'){
f++;}
}
}
c/=2;
e=e/2;
cout<<min(c,min(o,min(d,min(e,min(h,f)))))<<endl;
}
return 0;
}