Imports System
Imports System.Collections.Generic
Public Class Program
Public Shared Function generate_2_digit_permutations_from_3_digit_number(ByVal threeDigitNumber As String) As ISet(Of String)
Dim twoDigitPermutations As ISet(Of String) = New HashSet(Of String)()
For i As Integer = 0 To threeDigitNumber.Length - 1
For j As Integer = 0 To threeDigitNumber.Length - 1
If i <> j Then
twoDigitPermutations.Add("" & threeDigitNumber(i) & threeDigitNumber(j))
End If
Next
Next
Return twoDigitPermutations
End Function
Public Shared Sub Main(ByVal args As String())
Dim threeDigitNumber As String = "185"
Dim twoDigitPermutations As ISet(Of String) = generate_2_digit_permutations_from_3_digit_number(threeDigitNumber)
Console.WriteLine(String.Join(", ", twoDigitPermutations))
End Sub
End Class
' run:
'
' 18, 15, 81, 85, 51, 58
'