import Data.List
import Data.Array.ST
import Data.Array
import Control.Monad

getA2Zsorted::[Char]->[Int]
getA2Zsorted cs = let ar = runSTArray $ do
                                        ar<-newArray ('a','z') 0
                                        forM_ cs (\c->do
                                                      v<-readArray ar c
                                                      writeArray ar c (v+1)
                                                  )
                                        return ar
                  in
                  (sort.elems) ar

solver::[Char]->[Char]->Bool
solver cs ds = ((getA2Zsorted cs)==(getA2Zsorted ds))

main::IO()
main=do
  cs<-getLine
  ds<-getLine
  putStr (if (solver cs ds) then "Yes\n" else "No\n")