Module Module1
Function Ishere(ByVal a() As Integer, ByVal x As Integer) As Integer
Dim i As Integer = 0
Dim k As Integer = -1
Dim b() As Integer
Dim po As Integer = 1
For Each m In a
If x = m Then
b(i) = po
k = 0
i += 1
End If
po += 1
Next
If k = -1 Then
b(i) = -1
Return b(i - 1)
Else
Return b(i - 1)
End If
End Function
Sub print(ByVal a() As Integer)
For Each x In a
Console.Write("{0}" + vbTab, x)
Next
Console.WriteLine()
End Sub
Sub Main()
Dim a() As Integer = {11, 12, 11, 14, 15, 16, 17, 18, 19, 20}
Dim x As Integer
Dim b() As Integer
x = Console.ReadLine
print(Ishere(a, x))
End Sub
End Module
Function Ishere(ByVal a() As Integer, ByVal x As Integer) As Integer
Dim i As Integer = 0
Dim k As Integer = -1
Dim b() As Integer
Dim po As Integer = 1
For Each m In a
If x = m Then
b(i) = po
k = 0
i += 1
End If
po += 1
Next
If k = -1 Then
b(i) = -1
Return b(i - 1)
Else
Return b(i - 1)
End If
End Function
Sub print(ByVal a() As Integer)
For Each x In a
Console.Write("{0}" + vbTab, x)
Next
Console.WriteLine()
End Sub
Sub Main()
Dim a() As Integer = {11, 12, 11, 14, 15, 16, 17, 18, 19, 20}
Dim x As Integer
Dim b() As Integer
x = Console.ReadLine
print(Ishere(a, x))
End Sub
End Module