package main import ( "bufio" "fmt" "os" "strconv" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Scan() N, _ := strconv.Atoi(sc.Text()) S := make([]string, N) for i := 0; i < N; i++ { sc.Scan() S[i] = sc.Text() } mm := make(map[string]int) for _, s := range S { for k := 0; k < len(s); k++ { s1 := s[0:k] + "?" + s[k+1:] mm[s1] = mm[s1] + 1 } } for _, s := range S { count := 0 for k := 0; k < len(s); k++ { s1 := s[0:k] + "?" + s[k+1:] count += mm[s1] - 1 } fmt.Println(count) } }