Pergunta de entrevista da empresa Synchrony

Given a String ="abcd" and asked to print all the combinations in it