Given a list of couple of character
["A-B", "C-D", "E-F", "B-C", "A-E", "A-F", "F-C"]
How do I find all the direct links between two character? For instance, let's say that the input of the algorithm is the list above and i want to find the connection between "A-C", the desired output is:
["A-B-C", "A-E-F-C"]