// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open System

[<EntryPoint>]
let main argv = 
    let input = stdin.ReadLine()

    let a = input.ToCharArray() |> Array.countBy(fun x -> x)

    if a.Length = 2 && 
      (a 
      |> Array.filter(fun (key, count) -> count = 2) 
      |> Array.length = a.Length) then
        printfn "Yes"
    else
        printfn "No"

    0 // return an integer exit code
