void main()
{
	char a[100],b[100];
	int c[100]={0},d[100]={0};
	int i,j,l1,l2;
	scanf("%s %s",a,b);	
	l1=strlen(a);
	l2=strlen(b);
	for(i=0;i<l1;i++)
	{
		switch(a[i])
		{
		case'a':c[0]++;break;
		case'b':c[1]++;break;
		case'c':c[2]++;break;
		case'd':c[3]++;break;
		case'e':c[4]++;break;
		case'f':c[5]++;break;
		case'g':c[6]++;break;
		case'h':c[7]++;break;
		case'i':c[8]++;break;
		case'j':c[9]++;break;
		case'k':c[10]++;break;
		case'l':c[11]++;break;
        case'm':c[12]++;break;
		case'n':c[13]++;break;
		case'o':c[14]++;break;
		case'p':c[15]++;break;
		case'q':c[16]++;break;
		case'r':c[17]++;break;
		case's':c[18]++;break;
		case't':c[19]++;break;
		case'u':c[20]++;break;
		case'v':c[21]++;break;
		case'w':c[22]++;break;
		case'x':c[23]++;break;
		case'y':c[24]++;break;
		case'z':c[25]++;break;
		case'A':c[26]++;break;
		case'B':c[27]++;break;
		case'C':c[28]++;break;
		case'D':c[29]++;break;
		case'E':c[30]++;break;
		case'F':c[31]++;break;
		case'G':c[32]++;break;
		case'H':c[33]++;break;
		case'I':c[34]++;break;
		case'J':c[35]++;break;
		case'K':c[36]++;break;
		case'L':c[37]++;break;
		case'M':c[38]++;break;
		case'N':c[39]++;break;
		case'O':c[40]++;break;
		case'P':c[41]++;break;
		case'Q':c[42]++;break;
		case'R':c[43]++;break;
		case'S':c[44]++;break;
		case'T':c[45]++;break;
		case'U':c[46]++;break;
		case'V':c[47]++;break;
		case'W':c[48]++;break;
		case'X':c[49]++;break;
		case'Y':c[50]++;break;
		case'Z':c[51]++;break;
		}
	}
	for(j=0;j<l2;j++)
	{
		switch(b[j])
		{
		case'a':d[0]++;break;
		case'b':d[1]++;break;
		case'c':d[2]++;break;
		case'd':d[3]++;break;
		case'e':d[4]++;break;
		case'f':d[5]++;break;
		case'g':d[6]++;break;
		case'h':d[7]++;break;
		case'i':d[8]++;break;
		case'j':d[9]++;break;
		case'k':d[10]++;break;
		case'l':d[11]++;break;
        case'm':d[12]++;break;
		case'n':d[13]++;break;
		case'o':d[14]++;break;
		case'p':d[15]++;break;
		case'q':d[16]++;break;
		case'r':d[17]++;break;
		case's':d[18]++;break;
		case't':d[19]++;break;
		case'u':d[20]++;break;
		case'v':d[21]++;break;
		case'w':d[22]++;break;
		case'x':d[23]++;break;
		case'y':d[24]++;break;
		case'z':d[25]++;break;
		case'A':d[26]++;break;
		case'B':d[27]++;break;
		case'C':d[28]++;break;
		case'D':d[29]++;break;
		case'E':d[30]++;break;
		case'F':d[31]++;break;
		case'G':d[32]++;break;
		case'H':d[33]++;break;
		case'I':d[34]++;break;
		case'J':d[35]++;break;
		case'K':d[36]++;break;
		case'L':d[37]++;break;
		case'M':d[38]++;break;
		case'N':d[39]++;break;
		case'O':d[40]++;break;
		case'P':d[41]++;break;
		case'Q':d[42]++;break;
		case'R':d[43]++;break;
		case'S':d[44]++;break;
		case'T':d[45]++;break;
		case'U':d[46]++;break;
		case'V':d[47]++;break;
		case'W':d[48]++;break;
		case'X':d[49]++;break;
		case'Y':d[50]++;break;
		case'Z':d[51]++;break;
		}
	}
	if(l1==l2&&c[0]==d[0]&&c[1]==d[1]&&c[2]==d[2]&&c[3]==d[3]&&c[4]==d[4]&&c[5]==d[5]&&c[6]==d[6]&&c[7]==d[7]&&c[8]==d[8]&&c[9]==d[9]&&c[10]==d[10]&&c[11]==d[11]&&c[12]==d[12]&&c[13]==d[13]&&c[14]==d[14]&&c[15]==d[15]&&c[16]==d[16]&&c[17]==d[17]&&c[18]==d[18]&&c[19]==d[19]&&c[20]==d[20]&&c[21]==d[21]&&c[22]==d[22]&&c[23]==d[23]&&c[24]==d[24]&&c[25]==d[25]&&c[26]==d[26]&&c[27]==d[27]&&c[28]==d[28]&&c[29]==d[29]&&c[30]==d[30]&&c[31]==d[31]&&c[32]==d[32]&&c[33]==d[33]&&c[34]==d[34]&&c[35]==d[35]&&c[36]==d[36]&&c[37]==d[37]&&c[38]==d[38]&&c[39]==d[39]&&c[40]==d[40]&&c[41]==d[41]&&c[42]==d[42]&&c[43]==d[43]&&c[44]==d[44]&&c[45]==d[45]&&c[46]==d[46]&&c[47]==d[47]&&c[48]==d[48]&&c[49]==d[49]&&c[50]==d[50]&&c[51]==d[51])
		printf("YES");
	else
		printf("NO");
}