```go
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
s, _ := reader.ReadString('\n')
s = strings.TrimSpace(s)
n := len(s)
distinctTotal := 0
seen := make([]bool, 26)
for i := 0; i < n; i++ {
c := s[i] - 'a'
if !seen[c] {
seen[c] = true
distinctTotal++
}
}
atMost := make([]int64, distinctTotal+1)
for k := 1; k <= distinctTotal; k++ {
atMost[k] = countAtMost(s, k)
}
fmt.Println(distinctTotal)
for k := 1; k <= distinctTotal; k++ {
fmt.Println(atMost[k] - atMost[k-1])
}
}
func countAtMost(s string, k int) int64 {
if k == 0 {
return 0
}
n := len(s)
count := make([]int, 26)
distinct := 0
var res int64 = 0
left := 0
for right := 0; right < n; right++ {
idx := s[right] - 'a'
if count[idx] == 0 {
distinct++
}
count[idx]++
for distinct > k {
idxLeft := s[left] - 'a'
count[idxLeft]--
if count[idxLeft] == 0 {
distinct--
}
left++
}
res += int64(right - left + 1)
}
return res
}
```