#!/usr/bin/env python a = input().strip() b = input().strip() a = list(a) b = list(b) if sorted(a) == sorted(b): print('YES') else: print('NO')