# CFMM Problem | CodeChef

Guys im stuck with this problem and need your help !
normal cases are running fine but corner cases are failing can anybody please help me out !
My code is below
/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;
import java.util.HashMap;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void solve(String arr[]){
HashMap<Character,Integer> l1 =new HashMap<>();
l1.put(‘c’,0);l1.put(‘o’,0);l1.put(‘d’,0);l1.put(‘e’,0);l1.put(‘h’,0);l1.put(‘f’,0);
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr[i].length();j++){
if(arr[i].charAt(j)==‘c’ || arr[i].charAt(j)==‘o’ || arr[i].charAt(j)==‘d’ || arr[i].charAt(j)==‘e’ || arr[i].charAt(j)==‘h’ || arr[i].charAt(j)==‘f’){
if(l1.get(arr[i].charAt(j))!=null){
l1.put(arr[i].charAt(j),l1.get(arr[i].charAt(j))+1);
}
else if(l1.get(arr[i].charAt(j))==null){
l1.put(arr[i].charAt(j),1);
}
}
}
}
if(l1.get(‘c’)<2 && l1.get(‘e’)<2){
System.out.println(0);
return;
}
else if(l1.get(‘c’)>=2 && l1.get(‘e’)>=2){
if(l1.get(‘c’)==l1.get(‘e’)){
int c=l1.get(‘c’);
if(l1.get(‘o’)>=c/2 && l1.get(‘d’)>=c/2 && l1.get(‘h’)>=c/2 && l1.get(‘f’)>=c/2){
System.out.println(c/2);
}
else if(l1.get(‘o’)>=1 && l1.get(‘d’)>=1 && l1.get(‘h’)>=1 && l1.get(‘f’)>=1){
System.out.println(1);
}
else{
System.out.println(0);
}
}
else if(l1.get(‘c’)!=l1.get(‘e’)){
int min=0;
if(l1.get(‘c’)>l1.get(‘e’)){
min=l1.get(‘e’);
}
else{
min=l1.get(‘c’);
}
if(l1.get(‘o’)>=min/2 && l1.get(‘d’)>=min/2 && l1.get(‘h’)>=min/2 && l1.get(‘f’)>=min/2){
System.out.println(min/2);
}
else if(l1.get(‘o’)>=1 && l1.get(‘d’)>=1 && l1.get(‘h’)>=1 && l1.get(‘f’)>=1){
System.out.println(1);
}

``````            else{
System.out.println(0);
}
}
}

}
public static void main (String[] args) throws java.lang.Exception
{
Scanner in = new Scanner(System.in);
int t=in.nextInt();
for(int i=1;i<=t;i++){
int n=in.nextInt();
String arr[]=new String[n];
for(int j=0;j<n;j++){
arr[j]=in.next();
}
solve(arr);
}
}
``````

}