I'm trying to generate incremental combinations from a string, like:
// for "23405"
2
3
4
5
23
34
40
05
234
340
405
2340
3405
23405
I'm doing it with nested loops:
str := "23405"
for i := 0; i <= len(str); i++ {
for j := 0; j <= i; j++ {
fmt.Println(str[j:i])
}
}
Is it possible to do the same with recursive function? I'm writing it with go but an example in any language would be helpful. Here's the playground link.