// No.69 文字を自由に並び替え
package main

import (
	"fmt"
	"reflect"
	"sort"
	"strings"
)

func main() {
	var a, b string
	fmt.Scan(&a, &b)

	s1 := strings.Split(a, "")
	sort.Slice(s1, func(i, j int) bool { return s1[i] < s1[j] })

	s2 := strings.Split(b, "")
	sort.Slice(s2, func(i, j int) bool { return s2[i] < s2[j] })

	// compare strings
	if reflect.DeepEqual(s1, s2) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}