Pergunta de entrevista da empresa STMicroelectronics

Given a string print all non empty sub strings? ex: "abc" output: ab, bc, ac, abc