1510. 亲密字符串(回顾)
1510. 亲密字符串
中文English
给定两个由小写字母构成的字符串A
和B
,只要我们可以通过交换A
中的两个字母得到与B
相等的结果,就返回true
;否则返回false
。
样例
Example 1:
Input: A = "ab", B = "ba"
Output: true
Example 2:
Input: A = "ab", B = "ab"
Output: false
Example 3:
Input: A = "aa", B = "aa"
Output: true
Example 4:
Input: A = "aaaaaaabc", B = "aaaaaaacb"
Output: true
Example 5:
Input: A = "", B = "aa"
Output: false
注意事项
1.0 <= A.length <= 20000
2.0 <= A.length <= 20000
3.A
and B
consist only of lowercase letters.