def hits(origin, res):
    """
    calculate the hit number of recommend result
    :param origin: dict {user:[item,...]} the user click or behave items
    :param res: dict {user:[item,...]} the algorithm recommend result
    :return: int the number of res result in origin
    """
    hitCount = {}
    for user, items in origin.items():
        rs_items = res[user]
        hitCount[user] = len(set(items).intersection(set(rs_items)))
    return hitCount