#include #include #include #include #include #include using namespace std; // #define int short #define endl "\n" const long long INF = (long long)1e18; const long long MOD = (long long)1e9 + 7; string yn(bool f){return f?"Yes":"No";} string YN(bool f){return f?"YES":"NO";} const int NUM = 26; int H, W, K; short con[2005][2005][26]; inline int check(int y, int x, int sz){ int level = 0; sz--; if(sz < 0) return 0; if(sz + y >= H || sz + x >= W) return NUM+1; int y2 = y + sz, x2 = x + sz; for(int i = 0; i < NUM; i++){ int sum = con[y2+1][x2+1][i] - con[y2+1][x][i] - con[y][x2+1][i] + con[y][x][i]; level += !!sum; } return level; } signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout< squares; cin>>H>>W>>K; squares.resize(H); for(int i = 0; i < H; i++){ cin>>squares[i]; for(int j = 0; j < W; j++){ con[i+1][j+1][squares[i][j] - 'a']++; } } for(int k = 0; k < NUM; k++){ for(int i = 0; i <= H; i++){ for(int j = 0; j <= W; j++){ con[i][j+1][k] += con[i][j][k]; if(i) con[i][j][k] += con[i-1][j][k]; } } } for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ int h = min(H-i, W-j) + 1, l = 0, m; int a, b; while(l + 1 < h){ m = (l + h)/2; if(check(i,j,m) > K){ h = m; } else { l = m; } } a = h; h = min(H-i, W-j) + 1, l = 0; while(l + 1 < h){ m = (l + h)/2; if(!(check(i,j,m) < K)){ h = m; } else { l = m; } } b = l; ans += a - b - 1; } } cout<