Imports System
Imports System.Collections.Generic
Public Class Program
Public Shared Function two_strings_have_same_words_in_different_order(ByVal str1 As String, ByVal str2 As String) As Boolean
If str1.Length <> str2.Length Then
Return False
End If
Dim arr1 As String() = str1.Split(" "c)
Dim wordsOfStr1 As List(Of String) = New List(Of String)(arr1)
Dim wordsOfStr2 As String() = str2.Split(" "c)
For i As Integer = 0 To wordsOfStr2.Length - 1
If Not wordsOfStr1.Contains(wordsOfStr2(i)) Then Return False
Next
Return True
End Function
Public Shared Sub Main(ByVal args As String())
Dim str1 As String = "java c# c vb python"
Dim str2 As String = "python vb java c# c"
If two_strings_have_same_words_in_different_order(str1, str2) Then
Console.WriteLine("yes")
Else
Console.WriteLine("no")
End If
End Sub
End Class
' run:
'
' yes
'