Common Gem Elements

Each string describes a rock’s composition, and each character represents an element found in it. The function gem_stones receives a list of strings arr. An element is considered a gem if it appears in every rock at least once. Return the number of such common characters.

Примеры

Ввод
["abcdde", "baccd", "eeabg"]
Вывод
2
Ввод
["abc", "abc", "abc"]
Вывод
3
Ввод
["ab", "cd"]
Вывод
0

Нужно реализовать

def gem_stones(arr: list[str]) -> int:

Теги

stringssethashmap
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
["abcdde","baccd","eeabg"]
Expected2
2
Input
["abc","abc","abc"]
Expected3
3
Input
["ab","cd"]
Expected0
4
Input
["abcd"]
Expected4
5
Input
["basketball","baseball"]
Expected5
6
Input
["abc"]
Expected3
Focus radio
Paused · SomaFM · Fluid