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