program fifty_fifty
    implicit none
    integer(4):: i,ai,alphabet_counts(26) = 0, count
    character(4):: s

    read*, s

    do i=1,4
        ai=ichar(s(i:i))-64
        alphabet_counts(ai)=alphabet_counts(ai)+1
    end do

    do i=1,26
        count = alphabet_counts(i)
        if (count /= 2 .and. count/= 0) then
            print*, 'No'
            stop
        end if
    end do

    print*, 'Yes'
end program fifty_fifty