unittest
{
	assert( [ "axyb", "abyxb" ].parse.expand.solve == "axb" );
	assert( [ "aa", "xayaz" ].parse.expand.solve == "aa" );
	assert( [ "a", "z" ].parse.expand.solve == "" );
	assert( [ "abracadabra", "avadakedavra" ].parse.expand.solve == "aaadara" );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	input.popFront;
	auto t = input.front;
	return tuple( s, t );
}

auto solve( string s, string t )
{
	auto dp = new string[][]( 1 + s.length, 1 + t.length );
	for( auto si = 0L; si < s.length; si++ )
	{
		for( auto ti = 0L; ti < t.length; ti++ )
		{
			if( s[ si ] == t[ ti ] )
			{
				dp[ si + 1 ][ ti + 1 ] = dp[ si ][ ti ] ~ s[ si ];
			}
			else
			{
				if( dp[ si + 1 ][ ti ].length <= dp[ si ][ ti + 1 ].length ) dp[ si + 1 ][ ti + 1 ] = dp[ si ][ ti + 1 ];
				else                                                         dp[ si + 1 ][ ti + 1 ] = dp[ si + 1 ][ ti ];
			}
		}
	}
	return dp[ $ - 1 ][ $ - 1 ];
}
