Generating combinations of substrings from a string
e.g for "abc"
, sub strings would be {"abc" ,"acb" ,"bac" ,"bca" ,"cab" ,"cba"}
Solution:
q)distinct {x@{ c:count x;r where c=count each distinct each r:(cross/)c#enlist x }[til count x]}["abc"]