how to show the last terms of a taxonomy

I’m trying to show the only the last terms of a taxonomy in a post.

For example, the post “Johnny Pastafrolla” has the following terms of the taxonomy “camp” selected:

  • Summer Camp
    • Summer Camp 2018
    • Summer Camp 2019
  • Space Camp
  • Winter Camp

In this case, the displayed terms are gonna be:
Summer Camp 2018, Summer Camp 2019, Space Camp, Winter Camp 2017

I found a code online which is doing this, but for Categories.

add_filter( 'the_category_list', 'ci_theme_the_category_list_remove_parent_categories', 10 );
function ci_theme_the_category_list_remove_parent_categories( $categories ) {
    $categories_tmp = $categories;
    foreach ( $categories_tmp as $child_cat ) {
        foreach ( $categories_tmp as $key => $parent_cat ) {
            if ( isset( $categories( $key ) ) ) {
                if ( cat_is_ancestor_of( $parent_cat, $child_cat ) ) {
                    unset( $categories( $key ) );
                }
            }
        }
    }

    return $categories;
}

I’m trying to “adapt it” for this specific taxonomy, but I’m kind of lost.
Any hint?

Thank you

Dave