#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
char a[1505][1505];
int next[8][2]={{1,1},{-1,1},{-1,-1},{1,-1},{-1,0},{1,0},{0,1},{0,-1}},n,m,starc=0,star=0,galac=0;
int starz[100005],gala[100],galas[100];
void bfs(int x,int y)
{
a[x][y]='.';
for (int i=0;i<8;++i)
{
int xx=x+next[i][0],yy=y+next[i][1];
if (a[xx][yy]=='*'&&xx>=1&&xx<=n&&yy>=1&&yy<=m)
{
++starc;
bfs(xx,yy);
}
}
}
int main()
{
cin>>n>>m;
for (int i=1;i<=n;++i)
for (int j=1;j<=m;++j) cin>>a[i][j];
for (int i=1;i<=n;++i)
{
for (int j=1;j<=m;++j)
{
starc=1;
if (a[i][j]=='*')
{
bfs(i,j);
starz[++star]=starc;
}
}
}
for (int i=1;i<=star;++i)
{
bool f=0;
for (int j=1;j<=galac;++j)
{
if (galas[j]==starz[i])
{
f=1;
gala[j]+=starz[i];
break;
}
}
if (f) continue;
++galac;
gala[galac]+=starz[i];
galas[galac]=starz[i];
}
cout<<galac<<' ';
int maxx=-1;
for (int i=1;i<=galac;++i) maxx=max(gala[i],maxx);
cout<<maxx;
return 0;
}