program main
implicit none
integer :: i, j, k, l
character :: s*200000, t*200000
integer :: a(26), b(26)

read(*,*) s
read(*,*) t
l = len(s)
a = 0
b = 0
do i = 1, l
   do j = 1, 26
      k = j+96
      if( ichar(s(i:i)) == k ) then
         a(j) = a(j)+1
      end if
      if( ichar(t(i:i)) == k ) then
         b(j) = b(j)+1
      end if
   end do
end do
j = 0
k = 0
do i = 1, 26
   if( a(i) /= b(i) ) then
      if( a(i) /= 0 ) then
         j = j + 1
      end if
      if( b(i) /= 0 ) then
         k = k + 1
      end if
   end if
end do
if( j == k ) then
   write(*,*) 'Yes'
else
   write(*,*) 'No'
end if

end program main
