problem
1071. Greatest Common Divisor of Strings
solution
class Solution {
public:
string gcdOfStrings(string str1, string str2) {
return (str1+str2==str2+str1) ?
(str1.substr(, gcd(str1.size(), str2.size()))) : "";
}
};
参考
1. Leetcode_easy_1071. Greatest Common Divisor of Strings;
完