2017 JUST Programming Contest 3.0 E. The Architect Omar
#include <iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;
const int maxn=1010;
//int b[maxn],k[maxn],l[maxn];
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
int b=0,l=0,k=0;
cin>>n;
string str;
while(n--)
{
cin>>str;
if(str[0]=='b')
{
b++;
}
else if(str[0]=='k')
{
k++;
}
else
{
l++;
}
}
int b1=b/2;
int tmp=b1;
tmp=min(tmp,k);
tmp=min(tmp,l);
cout<<tmp<<endl;
}
return 0;
}