这题要想清题意。
一开始没仔细思考题意,想去怎么匹配。
其实两串只要不想等,长的串的长度肯定是答案。
class Solution {
public:
int findLUSlength(string a, string b) {
int m=a.size();
int n=b.size();
if(m!=n) return max(m,n);
else if(a==b) return -1;
return n;
}
};