#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

char a[3000][3000];
vector<int> aa[3000];
int ind[3000];

int main()
{
  int i,j,m,n,h,lim,ans;
  vector<pair<int,int> > q;
  pair<int,int> tmp;
  scanf("%d%d",&m,&n);
  for (i=0;i<m;i++)
    scanf("%s",a[i]);
  for (i=0;i+1<m;i++)
  {
    aa[i].clear();
    for (j=0;j+1<n;j++)
    {
      if (((a[i][j]==a[i+1][j])&&(a[i][j+1]!=a[i+1][j+1]))
        ||((a[i][j]!=a[i+1][j])&&(a[i][j+1]==a[i+1][j+1])))
      {
        aa[i].push_back(j);
      }
    }
    reverse(aa[i].begin(),aa[i].end());
  }
  for (j=0;j+1<m;j++)
    ind[j]=aa[j].size()-1;
  ans=0;
  for (i=0;i<n;i++)
  {
    h=n-i;
    q.clear();
    if (h>ans) ans=h;
    for (j=0;j+1<m;j++)
    {
      while ((ind[j]>=0)&&(aa[j][ind[j]]<i)) ind[j]--;
      //if (i==0) cout<<lim<<endl;

      lim=h;
      while ((q.size()>=2)&&(q[q.size()-1].first>=lim)&&(q[q.size()-2].first>=lim))
      {
        tmp=make_pair(q[q.size()-2].first,q[q.size()-1].second+q[q.size()-2].second);
        if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
        q.pop_back();
        q.pop_back();
        q.push_back(tmp);
      }
      q.push_back(make_pair(lim,1));
      
      while ((q.size()>=2)&&(q[q.size()-1].first<=q[q.size()-2].first))
      {
        tmp=make_pair(q[q.size()-1].first,q[q.size()-1].second+q[q.size()-2].second);
        if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
        q.pop_back();
        q.pop_back();
        q.push_back(tmp);
      }

      if (ind[j]<0) lim=h;
      else lim=aa[j][ind[j]]-i+1;
      while ((q.size()>=2)&&(q[q.size()-1].first>=lim)&&(q[q.size()-2].first>=lim))
      {
        tmp=make_pair(q[q.size()-2].first,q[q.size()-1].second+q[q.size()-2].second);
        if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
        q.pop_back();
        q.pop_back();
        q.push_back(tmp);
      }
      q.push_back(make_pair(lim,0));
      
      while ((q.size()>=2)&&(q[q.size()-1].first<=q[q.size()-2].first))
      {
        tmp=make_pair(q[q.size()-1].first,q[q.size()-1].second+q[q.size()-2].second);
        if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
        q.pop_back();
        q.pop_back();
        q.push_back(tmp);
      }
    }
    lim=h;

    while ((q.size()>=2)&&(q[q.size()-1].first>=lim)&&(q[q.size()-2].first>=lim))
    {
      tmp=make_pair(q[q.size()-2].first,q[q.size()-1].second+q[q.size()-2].second);
      if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
      q.pop_back();
      q.pop_back();
      q.push_back(tmp);
    }
    q.push_back(make_pair(lim,1));
    
    while ((q.size()>=2)&&(q[q.size()-1].first<=q[q.size()-2].first))
    {
      tmp=make_pair(q[q.size()-1].first,q[q.size()-1].second+q[q.size()-2].second);
      if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
      q.pop_back();
      q.pop_back();
      q.push_back(tmp);
    }
    lim=0;

    while ((q.size()>=2)&&(q[q.size()-1].first>=lim)&&(q[q.size()-2].first>=lim))
    {
      tmp=make_pair(q[q.size()-2].first,q[q.size()-1].second+q[q.size()-2].second);
      if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
      q.pop_back();
      q.pop_back();
      q.push_back(tmp);
    }
    q.push_back(make_pair(lim,0));
    
    while ((q.size()>=2)&&(q[q.size()-1].first<=q[q.size()-2].first))
    {
      tmp=make_pair(q[q.size()-1].first,q[q.size()-1].second+q[q.size()-2].second);
      if (tmp.first*tmp.second>ans) ans=tmp.first*tmp.second;
      q.pop_back();
      q.pop_back();
      q.push_back(tmp);
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 22144