I'm writing a function with two inputs input1
and input2
as below.
Inside the input1
there are probably a pair of sublists which has one element is from input2 and the other element is same in each list of the pair.
This is an example of the mention pair: {"LNL", "OUT"}, {"CPC", "OUT"}
.
Note that the order in the sublist pair could also be {"OUT","LNL"}, {"CPC", "OUT"}
.
The deleted sublist from each pair could be any sublist. Just one reguirement is that keep one sublist remaning in the pair.
input1 = {{"LPL", "IN"}, {"GN", "LPL"}, {"LNL", "OUT"}, {"CPC",
"OUT"}, {"CNC", "GN"}};
input2 = {"LNL", "CPC"};
myfunction[input1_, input2_] := Module[{},
]
This is the expected output:
output = {{"LPL", "IN"}, {"GN", "LPL"}, {"CPC",
"OUT"}, {"CNC", "GN"}}
I was trying to list all possible cases but due to the same element in each sublist of the pair could be a lot so I gave up doing that way.
Forgot to ask question: how can I do it without having to list all same element in each sublist?