package main
import (
"bufio"
"os"
"strconv"
)
func main() {
in := bufio.NewScanner(os.Stdin)
in.Split(bufio.ScanWords)
in.Buffer(make([]byte, 1024), 1<<20)
nextInt := func() int {
in.Scan()
v, _ := strconv.Atoi(in.Text())
return v
}
nextStr := func() string {
in.Scan()
return in.Text()
}
n := nextInt()
m := nextInt()
k := nextInt()
grid := make([][]byte, n)
for i := 0; i < n; i++ {
grid[i] = []byte(nextStr())
}
if n > m {
t := make([][]byte, m)
for j := 0; j < m; j++ {
row := make([]byte, n)
for i := 0; i < n; i++ {
row[i] = grid[i][j]
}
t[j] = row
}
grid = t
n, m = m, n
}
var ans int64
var countA [400]int
var prefix [401]int
var pos [26][400]int
var plen [26]int
for top := 0; top < n-1; top++ {
topRow := grid[top]
for c := 0; c < m; c++ {
if topRow[c] == 'a' {
countA[c] = 1
} else {
countA[c] = 0
}
}
for bottom := top + 1; bottom < n; bottom++ {
botRow := grid[bottom]
for i := 0; i < 26; i++ {
plen[i] = 0
}
prefix[0] = 0
for c := 0; c < m; c++ {
if botRow[c] == 'a' {
countA[c]++
}
prefix[c+1] = prefix[c] + countA[c]
if topRow[c] == botRow[c] {
idx := int(topRow[c] - 'a')
pos[idx][plen[idx]] = c
plen[idx]++
}
}
for ch := 0; ch < 26; ch++ {
l := plen[ch]
if l < 2 {
continue
}
arr := pos[ch][:l]
p := 0
for j := 0; j < l; j++ {
thr := prefix[arr[j]+1] - k
for p < j && prefix[arr[p]] < thr {
p++
}
ans += int64(j - p)
}
}
}
}
out := bufio.NewWriterSize(os.Stdout, 1<<20)
out.WriteString(strconv.FormatInt(ans, 10))
out.Flush()
}