use std::collections::HashMap;
use std::io::{self, BufReader, BufWriter, Read, Write};

fn main() {
    let stdin = io::stdin();
    let mut stdin = BufReader::new(stdin.lock());
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());

    let mut buf = String::new();
    stdin.read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();

    let mut a = HashMap::new();
    for c in iter.next().unwrap().chars() {
        let entry = a.entry(c).or_insert(0);
        *entry += 1;
    }

    let mut b = HashMap::new();
    for c in iter.next().unwrap().chars() {
        let entry = b.entry(c).or_insert(0);
        *entry += 1;
    }

    if a == b {
        stdout.write(b"YES").unwrap();
    } else {
        stdout.write(b"NO").unwrap();
    }
}