The variable `mid` is going to end up just being the string's length, so it doesn't seem right to expect these two things to be equal.