Given list of strings. The task is to find the frequency of the elements which are common in all strings given in the list of strings.

**Examples:**

Input: test_list = ["gegek", "gfgk", "kingg"]Output: {'g': 2, 'k': 1}Explanation: g occurs twice in all Strings.Input: test_list = ["gefgek", "gfgk", "kinfgg"]Output: {'g': 2, 'k': 1, 'f' : 1}Explanation: f occurs once in all Strings.

**Method : Using reduce() + lamdba + Counter()**

The combination of above functions can be used to solve this problem. In this, we perform the key role of counting using Counter() and lambda coupled with reduce() is used to perform intersection and extension of logic to all the strings respectively.

## Python3

`# Python3 code to demonstrate working of ` `# Strings list intersection ` `# Using reduce() + lamdba + Counter() ` `from` `functools ` `import` `reduce` `from` `collections ` `import` `Counter ` ` ` `# initializing list ` `test_list ` `=` `[` `"geek"` `, ` `"gfgk"` `, ` `"king"` `] ` ` ` `# printing original list ` `print` `(` `"The original list is : "` `+` `str` `(test_list)) ` ` ` `# using & operator to perform intersection ` `res ` `=` `reduce` `(` `lambda` `a, b: a & b, (Counter(ele) ` `for` `ele ` `in` `test_list[` `1` `:]), ` ` ` `Counter(test_list[` `0` `])) ` ` ` `# printing result ` `print` `(` `"String intersection and frequency : "` `+` `str` `(` `dict` `(res))) ` |

*chevron_right*

*filter_none*

**Output**

The original list is : ['geek', 'gfgk', 'king'] String intersection and frequency : {'g': 1, 'k': 1}

Attention geek! Strengthen your foundations with the **Python Programming Foundation** Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the **Python DS** Course.

## Recommended Posts:

- Python | Merge List with common elements in a List of Lists
- Python - List Strings frequency in Matrix
- Python | Find sum of frequency of given elements in the list
- Python | Find common elements in list of lists
- Maximum length prefix such that frequency of each character is atmost number of characters with minimum frequency
- Python program to find tuples which have all elements divisible by K from a list of tuples
- Python program to find common elements in three lists using sets
- Python program to check if the list contains three consecutive common numbers in Python
- Python | List frequency of elements
- Python | Sort list elements by frequency
- Python | Group list elements based on frequency
- Python | Frequency grouping of list elements
- Python - Step Frequency of elements in List
- Python - Frequency of elements from other list
- Python - Restrict Elements Frequency in List
- Python - Fractional Frequency of elements in List
- Python program to convert a list of strings with a delimiter to a list of tuple
- Python - Common list elements and dictionary values
- Generate a list using given frequency list
- Python program to print Rows where all its Elements' frequency is greater than K

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.