title: Fastest way to determine if two strings differ by an adjacent character swap? C++
body: <p>I am writing a C++ algorithm that works very close to determining Damerau–Levenshtein distance, but in 3 sections.
  In other words, Damerau–Levenshtein distance returns a cost to get from string A to string B using 
  1. deletion/insertion "apple" to "aple" and vice versa
  2. substitution of a character "rock" to "rack"
  3. swapping of adjacent characters "art" to "rat"</p>
  
  <p>However, the algorithm I am writing must determine if string A can morph into string B using any combination of the above three conditions.</p>
  
  <p>Any advice on how to determine Damerau–Levenshtein distance in 3 different pieces?</p>