# Permutation with a condition [duplicate]

I need to create a set A={“a”, “b”, “c”, “d” “e”} and print all the permutations of the set with length 3 that satisfy the condition: element "a" has to be ahead of "c" and "d" has to occur at least once.

• Gorjan, I am having second thought about my answer. Do you mean that "a" and "c" have to always be present in the result, or that if they are both present, then "a" should come before "c"? – MarcoB May 20 '15 at 18:24
• im really not sure – Gorjan May 20 '15 at 18:29
• Hmm. If you don't know what problem you want to solve, then it's quite hard to solve it... – MarcoB May 20 '15 at 18:31
• i think the result should be {a,c,d}{d,a,c}{a,d,c} – Gorjan May 20 '15 at 18:36

Select[Tuples[{"a", "b", "c", "d", "e"}, 3],