public class compiler
  Shared Sub Main()
    Dim input As String = Console.ReadLine()
    Dim s1 As String = input.Substring(0, 1)
    Dim s2 As String = input.Substring(1, 1)
    Dim s3 As String = input.Substring(2, 1)
    Dim s4 As String = input.Substring(3, 1)
    
    Dim output As String = "No"
    If s1 = s2 Then
        If s1 <> s3 AndAlso s3 = s4 Then
            output = "Yes"
        End If
    ElseIf s1 = s3 Then
        If s1 <> s2 AndAlso s2 = s4 Then
            output = "Yes"
        End If
    ElseIf s1 = s4 Then
        If s1 <> s2 AndAlso s2 = s3 Then
            output = "Yes"
        End If
    End If
    
    Console.WriteLine(output)
  End Sub
end class
