function pp = merge(pp1, pp2, sp)

l1 = length(pp1);
l2 = length(pp2);

loc1 = strfind(pp1,sp);
loc2 = strfind(pp2,sp);


left1 = l1 - loc1;
left2 = l2 - loc2;



if loc1 >= loc2
    
    tmp1 = pp1(1:loc1);
    if left1 <= left2
        tmp2 = pp2(loc2+1:end);
    else
        tmp2 = pp1(loc1+1:end);
    end
    
else
    
    tmp1 = pp2(1:loc2);
    if left1 <= left2
        tmp2 = pp2(loc2+1:end);
    else
        tmp2 = pp1(loc1+1:end);
    end

end

pp = strcat(tmp1, tmp2);


