Groupby on subsets?

Hello,

I would like some help in order to achieve a kind of a “Groupby on subsets”.

Below is an example to explain what I am looking for.

The input table contains 3 columns A, B and C

Column A and B should be grouped together and C should be aggregated as a unique concatenate.

However, I would like values in column A and B to be grouped together if one is a subset of the other.

See the result I would like to achieve below:

A normal Groupby node would return 0 rows as cells in A and B do not fully match.

Any idea on how to do that would be highly appreciated.

NBA