import logging


def count(sents, w):
    """Count the times of w appear in sents.
       Args:
           sents: A string of a list of string.
           w: The count word.
    """
    if isinstance(sents, str):
        return sents.count(w)
    elif isinstance(sents, list):
        n = 0
        for st in sents:
            n += st.count(w)
        return n
    else:
        logging.error('The first input should be a string or a list of string.')
        exit(-1)