What's the best way to find the count of occurrences of strings from a list in a target string? Specifically, I have a list :
string_list = [
    "foo",
    "bar",
    "baz"
]
target_string = "foo bar baz bar"
# Trying to write this function!
count = occurrence_counter(target_string) # should return 4
I'd like to optimize to minimize speed and memory usage, if that makes a difference. In terms of size, I would expect that string_list may end up containing several hundred substrings.
 
     
     
     
     
     
     
     
     
    