title: Comparing lists of different sizes and return an indices
body: <p>I have 2 lists ... </p>
  
  <p>The first is something like </p>
  
  <pre><code>a = [imgType_a, imgType_b, imgType_c]
  </code></pre>
  
  <p>The second is something like</p>
  
  <pre><code>b = [img_foo_a, img_foo_b, img_foo_c, img_bar_a, img_bar_b, img_bar_c]
  </code></pre>
  
  <p>I'd like to compare the lists and return a list of indices that correspond <code>a</code> where the last letter in <code>a</code> matches the last letter in <code>b</code></p>
  
  <p>For the example about I'd like to return ...</p>
  
  <pre><code>[0, 1, 2, 0, 1, 2]
  </code></pre>
  
  <p>if </p>
  
  <pre><code>a = [imgType_c, imgType_b, imgType_a]
  </code></pre>
  
  <p>and </p>
  
  <pre><code>b = [img_foo_a, img_foo_b, img_foo_c, img_bar_c, img_bar_a, img_bar_b, img_baz_a, img_qux_a]
  </code></pre>
  
  <p>the result would be </p>
  
  <pre><code>[2, 1, 0, 0, 2, 1, 2, 2]
  </code></pre>
  
  <p>The length of the list <code>b</code> will always be <code>&gt;=a</code>.</p>