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.algorithm;
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[] );
	
	// 同じ文字を違う文字に置換する必要がある場合はダメ
	zip( s, t ).sort();
	foreach( i; 1L .. s.length.signed )
	{
		if( s[ i - 1 ] == s[ i ] && t[ i - 1 ] != t[ i ] ) return "No";
	}
	zip( t, s ).sort();
	foreach( i; 1L .. s.length.signed )
	{
		if( t[ i - 1 ] == t[ i ] && s[ i - 1 ] != s[ i ] ) return "No";
	}
	
	return "Yes";
}
