void turn(char a[10000],int ASCII[128],int n1)
{
	int i;
	i=0;
	while(i<=n1)
	{
		switch(a[i])
		{
		case 0:ASCII[0]=ASCII[0]+1;break;
		case 1:ASCII[1]=ASCII[1]+1;break;
		case 2:ASCII[2]=ASCII[2]+1;break;
		case 3:ASCII[3]=ASCII[3]+1;break;
		case 4:ASCII[4]=ASCII[4]+1;break;
		case 5:ASCII[5]=ASCII[5]+1;break;
		case 6:ASCII[6]=ASCII[6]+1;break;
		case 7:ASCII[7]=ASCII[7]+1;break;
		case 8:ASCII[8]=ASCII[8]+1;break;
		case 9:ASCII[9]=ASCII[9]+1;break;
		case 10:ASCII[10]=ASCII[10]+1;break;
		case 11:ASCII[11]=ASCII[11]+1;break;
		case 12:ASCII[12]=ASCII[12]+1;break;
		case 13:ASCII[13]=ASCII[13]+1;break;
		case 14:ASCII[14]=ASCII[14]+1;break;
		case 15:ASCII[15]=ASCII[15]+1;break;
		case 16:ASCII[16]=ASCII[16]+1;break;
		case 17:ASCII[17]=ASCII[17]+1;break;
		case 18:ASCII[18]=ASCII[18]+1;break;
		case 19:ASCII[19]=ASCII[19]+1;break;
		case 20:ASCII[20]=ASCII[20]+1;break;
		case 21:ASCII[21]=ASCII[21]+1;break;
		case 22:ASCII[22]=ASCII[22]+1;break;
		case 23:ASCII[23]=ASCII[23]+1;break;
		case 24:ASCII[24]=ASCII[24]+1;break;
		case 25:ASCII[25]=ASCII[25]+1;break;
		case 26:ASCII[26]=ASCII[26]+1;break;
		case 27:ASCII[27]=ASCII[27]+1;break;
		case 28:ASCII[28]=ASCII[28]+1;break;
		case 29:ASCII[29]=ASCII[29]+1;break;
		case 30:ASCII[30]=ASCII[30]+1;break;
		case 31:ASCII[31]=ASCII[31]+1;break;
		case 32:ASCII[32]=ASCII[32]+1;break;
		case 33:ASCII[33]=ASCII[33]+1;break;
		case 34:ASCII[34]=ASCII[34]+1;break;
		case 35:ASCII[35]=ASCII[35]+1;break;
		case 36:ASCII[36]=ASCII[36]+1;break;
		case 37:ASCII[37]=ASCII[37]+1;break;
		case 38:ASCII[38]=ASCII[38]+1;break;
		case 39:ASCII[39]=ASCII[39]+1;break;
		case 40:ASCII[40]=ASCII[40]+1;break;
		case 41:ASCII[41]=ASCII[41]+1;break;
		case 42:ASCII[42]=ASCII[42]+1;break;
		case 43:ASCII[43]=ASCII[43]+1;break;
		case 44:ASCII[44]=ASCII[44]+1;break;
		case 45:ASCII[45]=ASCII[45]+1;break;
		case 46:ASCII[46]=ASCII[46]+1;break;
		case 47:ASCII[47]=ASCII[47]+1;break;
		case 48:ASCII[48]=ASCII[48]+1;break;
		case 49:ASCII[49]=ASCII[49]+1;break;
		case 50:ASCII[50]=ASCII[50]+1;break;
		case 51:ASCII[51]=ASCII[51]+1;break;
		case 52:ASCII[52]=ASCII[52]+1;break;
		case 53:ASCII[53]=ASCII[53]+1;break;
		case 54:ASCII[54]=ASCII[54]+1;break;
		case 55:ASCII[55]=ASCII[55]+1;break;
		case 56:ASCII[56]=ASCII[56]+1;break;
		case 57:ASCII[57]=ASCII[57]+1;break;
		case 58:ASCII[58]=ASCII[58]+1;break;
		case 59:ASCII[59]=ASCII[59]+1;break;
		case 60:ASCII[60]=ASCII[60]+1;break;
		case 61:ASCII[61]=ASCII[61]+1;break;
		case 62:ASCII[62]=ASCII[62]+1;break;
		case 63:ASCII[63]=ASCII[63]+1;break;
		case 64:ASCII[64]=ASCII[64]+1;break;
		case 65:ASCII[65]=ASCII[65]+1;break;
		case 66:ASCII[66]=ASCII[66]+1;break;
		case 67:ASCII[67]=ASCII[67]+1;break;
		case 68:ASCII[68]=ASCII[68]+1;break;
		case 69:ASCII[69]=ASCII[69]+1;break;
		case 70:ASCII[70]=ASCII[70]+1;break;
		case 71:ASCII[71]=ASCII[71]+1;break;
		case 72:ASCII[72]=ASCII[72]+1;break;
		case 73:ASCII[73]=ASCII[73]+1;break;
		case 74:ASCII[74]=ASCII[74]+1;break;
		case 75:ASCII[75]=ASCII[75]+1;break;
		case 76:ASCII[76]=ASCII[76]+1;break;
		case 77:ASCII[77]=ASCII[77]+1;break;
		case 78:ASCII[78]=ASCII[78]+1;break;
		case 79:ASCII[79]=ASCII[79]+1;break;
		case 80:ASCII[80]=ASCII[80]+1;break;
		case 81:ASCII[81]=ASCII[81]+1;break;
		case 82:ASCII[82]=ASCII[82]+1;break;
		case 83:ASCII[83]=ASCII[83]+1;break;
		case 84:ASCII[84]=ASCII[84]+1;break;
		case 85:ASCII[85]=ASCII[85]+1;break;
		case 86:ASCII[86]=ASCII[86]+1;break;
		case 87:ASCII[87]=ASCII[87]+1;break;
		case 88:ASCII[88]=ASCII[88]+1;break;
		case 89:ASCII[89]=ASCII[89]+1;break;
		case 90:ASCII[90]=ASCII[90]+1;break;
		case 91:ASCII[91]=ASCII[91]+1;break;
		case 92:ASCII[92]=ASCII[92]+1;break;
		case 93:ASCII[93]=ASCII[93]+1;break;
		case 94:ASCII[94]=ASCII[94]+1;break;
		case 95:ASCII[95]=ASCII[95]+1;break;
		case 96:ASCII[96]=ASCII[96]+1;break;
		case 97:ASCII[97]=ASCII[97]+1;break;
		case 98:ASCII[98]=ASCII[98]+1;break;
		case 99:ASCII[99]=ASCII[99]+1;break;
		case 100:ASCII[100]=ASCII[100]+1;break;
		case 101:ASCII[101]=ASCII[101]+1;break;
		case 102:ASCII[102]=ASCII[102]+1;break;
		case 103:ASCII[103]=ASCII[103]+1;break;
		case 104:ASCII[104]=ASCII[104]+1;break;
		case 105:ASCII[105]=ASCII[105]+1;break;
		case 106:ASCII[106]=ASCII[106]+1;break;
		case 107:ASCII[107]=ASCII[107]+1;break;
		case 108:ASCII[108]=ASCII[108]+1;break;
		case 109:ASCII[109]=ASCII[109]+1;break;
		case 110:ASCII[110]=ASCII[110]+1;break;
		case 111:ASCII[111]=ASCII[111]+1;break;
		case 112:ASCII[112]=ASCII[112]+1;break;
		case 113:ASCII[113]=ASCII[113]+1;break;
		case 114:ASCII[114]=ASCII[114]+1;break;
		case 115:ASCII[115]=ASCII[115]+1;break;
		case 116:ASCII[116]=ASCII[116]+1;break;
		case 117:ASCII[117]=ASCII[117]+1;break;
		case 118:ASCII[118]=ASCII[118]+1;break;
		case 119:ASCII[119]=ASCII[119]+1;break;
		case 120:ASCII[120]=ASCII[120]+1;break;
		case 121:ASCII[121]=ASCII[121]+1;break;
		case 122:ASCII[122]=ASCII[122]+1;break;
		case 123:ASCII[123]=ASCII[123]+1;break;
		case 124:ASCII[124]=ASCII[124]+1;break;
		case 125:ASCII[125]=ASCII[125]+1;break;
		case 126:ASCII[126]=ASCII[126]+1;break;
		case 127:ASCII[127]=ASCII[127]+1;break;
		}
		i=i+1;
	}
}
int main()
{
	void turn(char a[10000],int ASCII[128],int n1);
	char a[10000],b[10000];
	int i,j,n1,n2,c1[128],c2[128];
	i=0;
	while(i<=127)
	{
		c1[i]=0;
		c2[i]=0;
		i=i+1;
	}
	i=0;
	while(i<=9999)
	{
		a[i]='\0';
		b[i]='\0';
		i=i+1;
	}
	i=0;
	do
	{
		scanf("%c",&a[i]);
		i=i+1;
	}
	while(a[i-1]!=' ');
	n1=i-2;
	i=0;
	while(scanf("%c",&b[i])!=EOF)
	{
		i=i+1;
	}
	n2=i-2;
	if(n2!=n1) 
	{
		printf("NO");
		return 0;
	}
	i=0;
	while(i<=n1)
	{
		turn(a,c1,n1);
		turn(b,c2,n1);
		i=i+1;
	}
	i=0;
	while(i<=127)
	{
		if(c1[i]!=c2[i]) break;
		i=i+1;
	}
	if(i==128)
	printf("YES");
	else printf("NO");
	
}