Perhaps this is what you want?
s = "orange apple grapes pear"
from itertools import product
l = s.split()
r='/'.join(''.join(k*v for k,v in zip(l, x))
for x in product(range(2), repeat=len(l))
if sum(x) > 1)
print r
If you use "ab c" (for clarity), the result:
bc/ac/ab/abc
(Updated after comment from the poster.)
source
share