open Scanf
open Printf

let a = Array.make 26 None

exception A

let f t s = try String.iteri
                  (fun i c -> let k = (Char.code c - Char.code 'a')
                    in match a.(k) with
                    | None -> a.(k) <- Some (String.get t i)
                    | Some x -> if x <> String.get t i
                      then raise A) s; "Yes"
  with A -> "No"

let () = let ans = scanf "%s\n%s\n" f in
  printf "%s\n" ans