program sample
    implicit none
    character(200000)::s,t
    character(1)::a,b
    integer(8) :: i,j,m,n,time
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    read(*,*) t
    n=len_trim(s)
    time=0
    do i=1,n
        if(s(i:i) .ne.  t(i:i))then
            a=s(i:i)
            b=t(i:i)
            m=i
            exit
        end if
    enddo

    do i=1,n
        if (s(i:i) .eq. a)then
            s(i:i)=b
        elseif(s(i:i) .eq. b)then
            s(i:i)=a
        end if
        if(s(i:i) .ne. t(i:i))then
            write(*,*)'No'
            stop
        end if

    end do
    write(*,*)'Yes'
    stop
end program sample
  

