I am trying to find the maximum occurrences of a string in a list using Python my code currently is:
def count_occurences(input_string):
    list1 = []
    items = input_string.split(", ")
    for item in items:
        item = item.rstrip()
   
    max=0
    for i in items:
        
        count = input_string.count(i)
        if count > max:
            max = count
    
    for j in items:
        frequency = input_string.count(j)
        if frequency == max:
            list1.append(j)
            list1.append(max)
            
    return list1
 
     
    