def gen_maximizer_expr(rules: list, valid_rules: set) -> str:
    """Generates and returns the LPP's maximzer function as a string. In this algorithm,
    the maximizing function is the points accumulated from the coefficients chosen.

    Args:
        - rules: a list of tupels containg the rules for an amount of rewards points
        - valid_rules: set of applicable rules for a given month's spendings
        
    Returns:
        - max: the maximizing function represented as a string where each term is points*times_applied
    """
    max = ""
    for i in valid_rules:
        if max == "":
            max = max + f"x[{i}]*{rules[i][0]}"
        else:
            max = max + f" + x[{i}]*{rules[i][0]}"
    max = max + f" + x[{len(rules)}]*{rules[0][0]}"
    
    return max