Reputation: 1
I have the following string:
Dim Str As String = "XYZ"
My goal is to achieve every possible string that include dots.
It should take care of:
1. Dot should be between Chars
2. The char order cant be change, its just need to insert some dot between chars.
For example:
X.YZ
XY.Z
X.Y.Z
Where should I start?
Upvotes: 0
Views: 118
Reputation: 2103
This might help you get started:
Imagine that a dot = 1 and no dot = 0. For example U.VX.YZ = U1V0X1Y0Z Now remove all the letters and you get some binary : 1010 This suggests you can go from 0000 to 1111 in dots (This is hard to explain) Try doing this process in reverse to get all answers.
For example:
String = "XYZ"
00 = XYZ
01 = XY.Z
10 = X.YZ
11 = X.Y.Z
Upvotes: 1