I have a number, which I want to split as shown below. I want to keep the order in which the number is present but the list which is made from this must maintain the original order of the number.
The number which I have is 3147 which can be split as shown below. 3147 can be split into 31, 47 or 3,1,47 etc. But the order of the original number musn't be lost.
So how can I implement this?
It would be best if I get an answer in Python but in any other language is also fine.
Input
3147
Output
[3,1,4,7]
[3,147]
[3,1,47]
[31,4,7]
[31,47]
etc