<?php
$input='MINAOLENTUBLI
TUBLIOLENMINA';
go($input);
function go($input){
$i=explode("\n", $input);
$b=$i[0];
$d=$i[1];
while(strlen($b)>0){
$l=compute($b, $d);
if($l===false)
break;
$arr[]=substr($b,0,$l);
$b=substr($b, $l);
$d=substr($d, 0, -$l);
}
echo count($arr)."\n";
foreach($arr as $v){
echo "$v\n";
}
};
function compute($b, $d){
for($i=strlen($b); $i>0 ;$i--){
if (substr($b,0,$i)===substr($d,-$i)){
return $i;
}
}
return false;
}
?>