Identical Strings from Swapping Characters

You are given two lowercase strings as arguments. Return true if the first string can be made identical to the second as a result of swapping only two characters exactly two times, false if not.

Requirements

  • Must return either true or false

Example #1

solve("nermitla", "terminal")
> true

  1. In the first string, character 'n' can be swapped with character 't' which gives us 'terminla'
  2. Then swapping characters 'l' and 'a' gives us 'terminal' which matches the second argument string, so we return true.

Example #2

solve("nerimtla", "terminal")
> false

  1. In the first string, character 'n' can be swapped with character 't' which gives us 'terimnla'
  2. Then swapping characters 'l' and 'a' gives us 'terimnal'. Since after two swaps the two strings do not match, we return false.