{$APPTYPE CONSOLE}
program ancient;

const
        st1='ancient.in';
        st2='ancient.out';
var
        ch:char;
        a,b:array[1..26] of integer;
        x,y:integer;
begin
        assign(input,st1); reset(input);
        assign(output,st2); rewrite(output);

        while not eoln do begin
                read(ch);
                inc(a[ord(ch)-64]);
        end;
        readln;

        while not eoln do begin
                read(ch);
                inc(b[ord(ch)-64]);
        end;

        for x:=1 to 26 do if a[x]>0 then begin
            for y:=1 to 26 do if b[y]=a[x] then begin
                a[x]:=0;
                b[y]:=0;
                break;
            end;
        end;

        for x:=1 to 26 do begin
                if a[x]>0 then begin writeln('NO'); close(output);  halt(0); end;
                if b[x]>0 then begin writeln('NO'); close(output);  halt(0); end;
        end;

        writeln('YES');
        close(input); close(output);
end.
