I want to optimize this code for counting the number of occurrences in a list of strings. To be specific, I have two lists
1) cat: a huge list of string with duplicates (duplicates must exist).
2) cat_unq: the distinct elements from cat.
What I am currently doing in my code is looping all unique elements in cat_unq and counting how many times the unique element exists in the list of duplicates. The search runs on a mobile …