Use the minimum of the two string lengths for comparison