def reduce_resource_name_to_task(res_name):
    """
    Assuming that the convention of naming resources associated with tasks as
    res[TASK][number], reduces such resource names to just the name of the
    task. This ensures that multiple copies of the same resource are treated
    the same. Resource names of different formats will be left untouched.
    """
    # Reduce resource names to tasks being rewarded
    if res_name[:3].lower() != "res":
        return res_name
    res_name = res_name[3:].lower()
    while res_name[-1].isdigit():
        res_name = res_name[:-1]
    return res_name