← 返回 netflix 的题目列表Count Pairs of Show Names Sharing No Common Characters
类型:online_judge
Problem: Count Pairs of Show Names with No Common Characters
Given a list of show names shows (array of strings). For a pair of indices (i, j) with 0 <= i < j < N, the pair is valid if shows[i] and shows[j] share no common character.
Return the number of valid pairs.
Character Set
Show names contain only lowercase letters a-z.
Input Format
Line 1: integer N
Line 2: N space-separated show names
Output Format
Print one integer: the number of valid pairs
Constraints
1 <= N <= 2e5
Each name length: 1..50
Sample Tests
Test 1 Input:
4
ab cd a bcd
Output:
2
Test 2 Input:
3
a aa aaa
Output:
0
Test 3 Input:
5
a b c d e
Output:
10
Test 4 Input:
4
abc def ghi jkl
Output:
6
Test 5 Input:
6
ab ac ad ae af ag
Output:
0
Example
Input
4
ab cd a bcd
Output
2