public int charArea(char ch) {
        int X = grid.length;
        int Y = grid[0].length;

        int i;
        boolean found = false;
        int minx = 100000, miny=100000, maxx=0,maxy=0;
        for(i=0;i<X;i++){
            int j;
            for(j=0;j<Y;j++){
                 if(grid[i][j] == ch){
                      found = true;

                     if(i<minx){
                         minx = i;
                     }
                     if(j<miny){
                         miny = j;
                     }
                     if(i>maxx){
                         maxx = i;
                     }
                     if(j>maxy){
                         maxy = j;
                     }
                 }
             }
        }

        if(found ){
            return (maxx-minx+1)*(maxy-miny+1);
        }
        return 0;

	}