forked from sanjiv1705/codechef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoa.cpp
More file actions
57 lines (46 loc) · 1.19 KB
/
coa.cpp
File metadata and controls
57 lines (46 loc) · 1.19 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i, t ;
cin>>t ;
for(i = 0; i<t ; i++)
{
int n, j, m =0,p=0, r=0,a =0,b=0, c=0, t=0;
cin>>n;
char s[1000];
for(j = 0 ; j<n; j++)
{
cin>>s;
int k ;
for(k= 0 ; k<strlen(s); k++)
{
if(s[k]=='c' )
r++;
else if(s[k]=='e')
m++;
else if(s[k]=='o' )
a++;
else if(s[k]=='d')
b++ ;
else if(s[k]=='h')
c++;
else if(s[k]=='f')
p++;
}
}
int w= r/2;
int f = m/2;
int num[6]={w , f ,a, b,c,p};
sort(num , num+6);
cout<<num[0]<<endl;
/*if(f>=w && a>=w && b>=w &&c>=w && p>=w)
cout<<w<<endl;
else if(w>f && a>=f && b>=f && c>=f && p >=f )
cout<<f<<endl;
else if(w>f && a>=f && b>=f && c>=f && p >=f )
else
cout<<0<<endl;*/
}
}