{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

var q,c:array[0..256]of longint;
    i,j,h:longint;
    ass:boolean;
    ch:char;
begin
assign(input,'ancient.in');
assign(output,'ancient.out');
reset(input);
rewrite(output);
while not eoln do
        begin
        read(ch);
        if ((ord(ch)>=ord('A'))and(ord(ch)<=ord('Z'))) then inc(q[ord(ch)]);
        end;
readln(ch);
while not eoln do
        begin
        read(ch);
        if ((ord(ch)>=ord('A'))and(ord(ch)<=ord('Z'))) then inc(c[ord(ch)]);
        end;
for i:=0 to 255 do
        for j:=i+1 to 256 do
                begin
                if q[i]>q[j] then
                        begin
                        h:=q[i]; q[i]:=q[j]; q[j]:=h;
                        end;
                if c[i]>c[j] then
                        begin
                        h:=c[i]; c[i]:=c[j]; c[j]:=h;
                        end;
                end;
ass:=false;
for i:=0 to 256 do
        ass:=(ass or (q[i]<>c[i]));
if ass then writeln('NO') else writeln('YES');
end.

