Imports System
Public Class A100
    Public Shared Sub Main()
        Dim N As Integer
        N = Console.ReadLine()
        Dim a, b, c, d As Integer
        d = N Mod 10
        c = ((N - d) / 10) Mod 10
        b = ((N - d - 10 * c) / 100) Mod 10
        a = (N - d - 10 * c - 100 * b) / 1000
        Dim k As Integer = 1
        If (a <> b) Then
            k += 1
        End If
        If (a <> c And b <> c) Then
            k += 1
        End If
        If (a <> d And b <> d And c <> d) Then
            k += 1
        End If
        If (k <= 2) Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If
    End Sub
End Class
