Imports System
Public Class Program
Public Shared Function mostFrequentWord(ByVal words As String()) As String
Dim frequency As Integer = 0
Dim size As Integer = words.Length
Dim frequent_word As String = ""
For i As Integer = 0 To size - 1
Dim count As Integer = 1
For j As Integer = i + 1 To size - 1
If words(j).Equals(words(i)) Then
count += 1
End If
Next
If count >= frequency Then
frequent_word = words(i)
frequency = count
End If
Next
Return frequent_word
End Function
Public Shared Sub Main(ByVal args As String())
Dim arr As String() = New String() {"java", "c++", "c", "c#", "c", "go", "php", "java", "java", "c", "python", "php", "c"}
Dim frequent_word As String = mostFrequentWord(arr)
Console.WriteLine(frequent_word)
End Sub
End Class
' run:
'
' c
'