title: Concatenate two lists using condition
body: <p>I need to concatenate lists <code>A</code> and <code>B</code> using condition that two lists transform to list <code>C</code>, with the same length, but each <code>i</code> element doesn't change position and list is sorted. Else return empty list:</p>
  
  <pre><code>A = ['a', 'b', 'c']
  B = ['x', 'y', 'z']
  </code></pre>
  
  <p>concatenated to: <code>C = ['a', 'b', 'z']</code>.</p>
  
  <p>or </p>
  
  <pre><code>A = ['8', '2', '3']
  B = ['1', '2', '0']
  </code></pre>
  
  <p>concatenated to: <code>C = ['1', '2', '3']</code>.</p>
  
  <p>I absolutely have no idea how I can start solve my problem. Which algorithm I have to use?</p>
  
  <p><strong>UPD:</strong></p>
  
  <p>Another examples:</p>
  
  <pre><code>A = ['a', 'b', 'c']
  B = ['x', 'x', 'x']
  </code></pre>
  
  <p>result is: <code>['a', 'b', 'x']</code></p>
  
  <pre><code>A = ['b', 'a']
  B = ['x', 'c']
  </code></pre>
  
  <p>result must be: <code>['b', 'c']</code>.</p>
  
  <p>And result of concatenation of these two lists is an empty list:</p>
  
  <pre><code>A = ['e','a'], 
  B = ['f','b']
  </code></pre>