import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Unboxed as VU
import Data.List
import Data.Char
import Control.Monad

main = do
    s <- B.getLine
    t <- B.getLine
    xs <- VUM.replicate 26 (0 :: Int)
    ys <- VUM.replicate 26 (0 :: Int)
    forM_ [0..B.length s - 1] $ \i -> do
        let s' = B.index s i
        let t' = B.index t i
        VUM.modify xs (+1) (ord s' - ord 'a')
        VUM.modify ys (+1) (ord t' - ord 'a')
    xs' <- sort . VU.toList <$> VU.unsafeFreeze xs
    ys' <- sort . VU.toList <$> VU.unsafeFreeze ys
    putStrLn $ if and $ zipWith (==) xs' ys' then "Yes" else "No"