You are viewing a single comment's thread. Return to all comments →
One liner
print(len(set.intersection(*[set(input()) for _ in range(int(input()))])))
Above code expanded to make it more understandable.
n = int(input()) a = [set(input()) for _ in range(n)] s = set(a[0]) for s1 in a: s = s & s1 print(len(s))
Basically, we need to perform the intersection of the sets of the characters and print the length of this intersection set formed.
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
One liner
Above code expanded to make it more understandable.
Basically, we need to perform the intersection of the sets of the characters and print the length of this intersection set formed.