#!/usr/bin/python # -*- coding: utf-8 -*- A = list(raw_input()) B = list(raw_input()) A.sort() B.sort() if A == B: print "YES" else: print "NO"