program sample
    implicit none
    character(200000)::s,t
    character(1)::a,b,x(26),y(26)
    integer(8) :: i,j,m,n,time,k
    
    read(*,*) s
    read(*,*) t
    n=len_trim(s)
    time=0
    x(:)='0'
    y(:)='0'
    do i=1,n
       
            
            a=s(i:i)
            b=t(i:i)
            call alfnumber(a,k)
            if(x(k) .eq. '0') then
                x(k)=b
            elseif(x(k) .ne. b)then
                write(*,*)'No'
                stop
            endif

            call alfnumber(b,k)
            if(y(k) .eq. '0') then
                y(k)=a
            elseif(y(k) .ne. a)then
                write(*,*)'No'
                stop
            endif
            
    enddo

    
    write(*,*)'Yes'
    stop
    contains
    subroutine alfnumber(st,a)
        implicit none
        character,intent(in) :: st
        integer(8),intent(out) ::  a
        integer::i
        character(1)::ch(26)
        ch=(/'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'/)
        do i=1,26
            if(st .eq. ch(i))then
                a=i
                return
            end if
        end do 
        end subroutine alfnumber
end program sample
  

