tags. Call two strings alike when they use exactly the same set of letters: neither how often each letter appears nor the order of the letters matters. For instance, "noon" and "on" are alike, "note" and "tone" are alike too, but "not" and "note" are not.
Count the index pairs (i, j) with i < j for which tags[i] and tags[j] are alike.tags=['mama', 'am', 'ma', 'stop', 'pots', 'tops', 'top'] → 6
"mama", "am" and "ma" all use the letters m and a, which gives three pairs. "stop", "pots" and "tops" all use s, t, o, p, which gives three more. "top" lacks the letter s, so it has no partner. Total: 6.
tags=['x', 'y', 'xy'] → 0
The letter sets {x}, {y} and {x, y} are all different, so no pair qualifies.
tags=['zz', 'z', 'zzz'] → 3
All three strings use only the letter z, so each of the three pairs counts.
tags.length ≤ 100tags[i].length ≤ 100tags[i] consists of lowercase English letters onlytags=['mama', 'am', 'ma', 'stop', 'pots', 'tops', 'top']
6
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.