Description

Given a string array words, return an array of all characters that appear in all strings in words, including duplicates. You may return the answer in any order.

Examples

Input:words = ["bella","label","roller"]
Output:["e","l","l"]
Explanation:

'e' and 'l' appear in all.

Input:words = ["abcde", "xyz", "pqr"]
Output:[]
Explanation:

No characters appear in all three strings, so the result is an empty list.

Input:words = ["aabbcc", "abcabc", "ccabba"]
Output:["a", "a", "b", "b", "c", "c"]
Explanation:

Each character 'a', 'b', and 'c' appears at least twice in every string, so each character is included twice in the result.

Constraints

  • 1 ≤ words.length ≤ 100

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!