h,w,k = map(int,input().split()) C = [[ord(x)-ord("a") for x in input()] for i in range(h)] accum = [[[0]*26 for i in range(w+1)] for i in range(h+1)] for i in range(h): for j in range(w): c = C[i][j] for t in range(26): accum[i+1][j+1][t] = accum[i+1][j][t]+accum[i][j+1][t]-accum[i][j][t] accum[i+1][j+1][c] += 1 def add(l,x,y,f): ll = accum[x][y] for i in range(26): l[i] += ll[i]*f return l def calc(a,b,c,d): l = [0]*26 l = add(l,c,d,1) l = add(l,a-1,b-1,1) l = add(l,c,b-1,-1) l = add(l,a-1,d,-1) num = 0 for i in l: if i > 0: num += 1 return num ans = 0 for i in range(1,h+1): lx,ly = i,1 rx,ry = i,1 for j in range(i,h+1): x,y = j,(j-i)+1 while lx < h+1 and calc(x,y,lx,ly) < k: lx,ly = lx+1,ly+1 while rx < h+1 and calc(x,y,rx,ry) <= k: rx,ry = rx+1,ry+1 if lx >= h+1: break if calc(x,y,lx,ly) == k: ans += rx-lx for i in range(2,w+1): lx,ly = 1,i rx,ry = 1,i for j in range(i,w+1): x,y = (j-i)+1,j while ly < w+1 and calc(x,y,lx,ly) < k: lx,ly = lx+1,ly+1 while ry < w+1 and calc(x,y,rx,ry) <= k: rx,ry = rx+1,ry+1 if ly >= w+1: break if calc(x,y,lx,ly) == k: ans += rx-lx print(ans)