unittest
{
	assert( [ "3", "abc", "cde" ].parse.expand.solve == 5 );
	assert( [ "1", "a", "z" ].parse.expand.solve == 2 );
	assert( [ "4", "expr", "expr" ].parse.expand.solve == 4 );
}



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 ) )
{
	input.popFront;
	auto s = input.front.to!( dchar[] );
	input.popFront;
	auto t = input.front.to!( dchar[] );
	return tuple( s, t );
}

auto solve( dchar[] s, dchar[] t )
{
	for( auto i = 0L; i < s.length; i++ )
	{
		if( s[ i .. $ ] == t[ 0 .. $ - i ] ) return s.length + i;
	}
	return s.length + t.length;
}
