Imports System
Public Module Module1
Function countOccurences(s As String, word As String) As Integer
Dim arr() As String = s.Split(" ")
Dim count As Integer = 0
For i As Integer = 0 To arr.Length - 1
If (word.Equals(arr(i))) Then
count = count + 1
End If
Next
return count
End Function
Public Sub Main()
Dim s As String = "vb.net c c++ c# vb.net java python vb.net"
Dim word As String = "vb.net"
Console.Write(countOccurences(s, word))
End Sub
End Module
' run:
'
' 3
'