unittest
{
	assert( [ "aab", "xyz" ].solve == "No" );		// 追加ケース
	assert( [ "xyz", "aab" ].solve == "No" );		// 追加ケース
	
	assert( [ "azzel", "apple" ].solve == "Yes" );
	assert( [ "chokudai", "redcoder" ].solve == "No" );
	assert( [ "abcdefghijklmnopqrstuvwxyz", "ibyhqfrekavclxjstdwgpzmonu" ].solve == "Yes" );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	input.popFront;
	auto t = input.front.to!( dchar[] );
	
	dchar[ dchar ] sts;
	dchar[ dchar ] tss;
	foreach( sc, tc; lockstep( s, t ) )
	{
		if( ( sc in sts && sts[ sc ] != tc ) || ( tc in tss && tss[ tc ] != sc ) ) return "No";
		sts[ sc ] = tc;
		tss[ tc ] = sc;
	}
	return "Yes";
}
