Reconstruct the ASCII art from a string I have a bunch of ASCII art that I have recovered from a failed hard drive. Unfortunately, all of the newlines were stripped out, and I don't know the resolution of the original artwork. I do know that each one was originally rectangular, but to make matters worse, all the white space at the beginning and end was stripped out too!

I do at least know what one small piece of each one looks like. Can you help me recover the artwork based on the input stream of bytes and the piece of ASCII art I remember?

Example

I remember this one:

__(((55^$$%^/\__%%//\/_666332@12


Had this diamond in it:

/\
\/


The original artwork in this case was 8 characters wide:

__(((55^
$$%^/\__
%%//\/_6
66332@12


Then there's this one, which had a bigger diamond in it.

/\/\/\/\/\:;/  \00F\/\/\  /E%epopox\/e


The diamond looked like this:

 /\
/  \
\  /
 \/


The original artwork contained that diamond, but the white space surrounding the diamond was not white space in the original artwork. I’ve only added in the white space to the left to get the indentation right.

More generally, in each row, any space to the left of the first non-white-space character is indentation padding, and any white space to the right necessarily represents actual white space. 

Note that this is also one of those pieces that has had its white space trimmed off. Here's the original, 11 characters wide, with white space restored:

   /\/\/\/\
/\:;/  \00F
\/\/\  /E%e
popox\/e   


Remember, the amount of white space removed is unknown. That means I can’t even figure out the possibilities for line length by finding the divisors of the input’s character count.

Input

A string of characters (the artwork, sans newlines, trimmed of white space at the beginning and end), and a two-dimensional string of characters (the piece to look for)

Essentially, the string of characters can be generated from the original artwork thus: artwork.Replace("\n", "").Trim(" ")

Output

The original artwork with newlines inserted where necessary, and with trimmed white space re-added to the beginning of the first line and the end of the last line. If there is more than one possible solution, you may return one arbitrarily (or all of them if you really want to).

Test Cases

Input:
__(((55^$$%^/\__%%//\/_666332@12
/\
\/

Output:
__(((55^
$$%^/\__
%%//\/_6
66332@12

-----------
Input:
 _-/\-_-_vv:;/  \00F\\||\  /E%epopox\/e0
 /\
/  \
\  /
 \/

Output:
   _-/\-_-_
vv:;/  \00F
\\||\  /E%e
popox\/e0  


--------
Input:
__               (  )               ||                ||            ___|""|__.._     /____________\    \____________/~~~.
(  )
 ||
 ||
 ""

Output:
     __           
    (  )          
     ||           
     ||           
 ___|""|__.._     
/____________\    
\____________/~~~.


--------
Input:
..XX...XX.......X..X..X  X.....X..X...X  X.....XX......XX...
 XX 
X  X
X  X
 XX 

Output:
..XX...XX.......
X..X..X  X.....X
..X...X  X.....X
X......XX...    


Notably, in this last case, the following is not valid output:

..XX...XX......
.X..X..X  X....
.X..X...X  X...
..XX......XX...


Credit to jrei @ asciiart.eu for the joystick

Rules


This is code golf, so shortest answer in bytes wins.
Default I/O rules apply
Perl 5, 192 bytes

To be golfed more


($_,@F)=@F;$l=max map length,@F;map{$_.=" "x($l-y///c);s/(^ +| +$)|\W/$1=~y, ,.,r||"\\$&amp;"/gme}@F;for$i(0..y///c){$"=".{$i}";$i+=$l,$_=" "x($i-"@-").$_,map{printf"%-$i\s
",$_}/.{1,$i}/g if/@F/}


Try it online!