#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} //end char s[2010][2010]; int dp[2010][2010][27]; int main(){ int h,w,k; cin>>h>>w>>k; rep(i,0,h)cin>>s[i]; for(int i=h;i>=0;i--)for(int j=w;j>=0;j--){ rep(c,0,27){ dp[i][j][c]=min({min(h-i,w-j)+1,dp[i][j+1][c], dp[i+1][j][c],dp[i+1][j+1][c]})+1; } if(islower(s[i][j]))dp[i][j][s[i][j]-'a']=1; } ll res=0; rep(i,0,h)rep(j,0,w){ sort(dp[i][j],dp[i][j]+27); res+=dp[i][j][k]-dp[i][j][k-1]; } cout<