Option Strict On

Module Module1
    Dim N As String
    Dim i, j, k As Int32

    Sub Main()
        N = Console.ReadLine()

        While i <= 9
            k = 0
            For j = 0 To 3
                If CInt(N(j) & "") = i Then
                    k += 1
                Else
                    k = 0
                End If

                If k >= 3 Then Exit While
            Next
            i += 1
        End While

        Console.WriteLine(
            New String() {"No", "Yes"}(k \ 3)
        )

    End Sub
End Module