title: replacing letters in text (pseudo-code)
body: <p>I'm making a script to create a username. It should be four letters long; traditionally we've used 3 letters of the last name + 1 of the first name.<br>
  If it was already used we manually thought of an alternative.</p>
  
  <p>So if my name is Fred Flinstones we should try FLIF. If this doesnt work; we loop through the name: FLIA, FLIB, FLIC ... FLIZ, FLAA, FLAB, FLAC, ... FLZZ, FAAA, FAAB, ...</p>
  
  <p>The easiest way is to loop through last letters; then make another set of loops through second last letter and loop through last letters; then a set of loops through third last, second last, last; and fourth+third+second+last.
  This makes a lot of do while loops nested in eachother + unreadable for other humans + a lot of typing.<br>
  I could use a counter per letter but that also doesn't seem elegant
  I could try with one counter and then using <code>mod 26</code> to see how many letters need replacement (but that seems very complex).  </p>
  
  <p>Is there some elegant/efficient ways to do this?  </p>
  
  <p><br/>Bonus points for first trying to keep the string as 'logically correct' as possible (f.e. keeping the last letter an F for Fred or skipping letters FLIF; FLNF, FLSF, FLTF, ...) .</p>