let arr_of_str s = Array.init (String.length s) (fun i -> i, s.[i])
let _ = print_endline @@ Scanf.scanf "%s %s" @@ fun s t ->
  let cv = Array.make 26 None in
  let res = Array.fold_left (fun b (i, c) -> (&&) b @@
    let d = int_of_char c - 97 in
    match cv.(d) with
    | None -> (( cv.(d) <- Some s.[i]; true ))
    | Some c' -> s.[i] = c') true (arr_of_str t)
  in if res then "Yes" else "No"