title: Algorithm for iterating through all strings of shortest lengths?
body: <p>I'm making a URL shortener, and I want to use the shortest possible string for each given URL. Each URL will have a different expiry date. </p>
  
  <p>For example, let's submit URLs that get shortened to the following list:</p>
  
  <p><code>a, b, c, ..., z, 0 ..., 9, aa, ab, ac, ... a9, ba</code></p>
  
  <p>Then, say <code>c</code> expires, so the next URL should be shortened to <code>c</code> instead of <code>bb</code>, since <code>c</code> is shorter and is not taken.</p>
  
  <p>What data structure would be good for keeping track of this?</p>