i've got arary of string like this C - F - A - M. i want to create a combination from that with condition:
- each other item beside last character has to be combined with last character
- there's not allowed a same combination, even the order is different. for example - FC - M - CF - M 
- if the string array contains >=3 element it will generate 2 & 3 itemset, if 2 element then it will generate only 2 itemset 
below is my code. my code generate the result like right part of the picture
my question is what method should i use? is it permutation, combination, or other things? and in pseudocode, what is my case would be like?
here's my code
Public Class permute
Dim ItemUsed() As Boolean
Dim pno As Long, pString As String
Dim inChars() As Char = {"c", "f", "a", "m"}
Private Sub permute_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
End Sub
Sub Permute(ByVal K As Long)
    ReDim ItemUsed(K)
    pno = 0
    Dim i As Integer
    For i = 2 To K
        Permutate(i, 1)
        tb.Text = K
    Next
End Sub
Private Sub Permutate(ByVal K As Long, ByVal pLevel As Long)
    Dim i As Long, Perm As String
    Perm = pString
    For i = 0 To K - 1
        If Not ItemUsed(i) Then
            If pLevel = 1 Then
                pString = inChars(i)
            Else
                pString += inChars(i)
            End If
            If pLevel = K Then
                pno = pno + 1
                Results.Text += _
                pno & " " & " = " & " " & pString & vbCrLf
                Exit Sub
            End If
            ItemUsed(i) = True
            Permutate(K, pLevel + 1)
            ItemUsed(i) = False
            pString = Perm
        End If
    Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Permute(tb.Text)
End Sub
Private Sub tb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tb.TextChanged
    If tb.Text = "" Then
        Results.Text = ""
    Else
        Permute(tb.Text)
    End If
End Sub
End Class
here's the requirement screenshot

and here's the program screenshot

 
     
     
    