Description
Submission
class Solution { public: bool repeatedSubstringPattern(string s) { int n = s.size(); for(int i = 1; i <= n/2; ++i) { string pat = s.substr(0, i); string t = s.substr(i, s.size()-i); while(t.size() >= i) { if(pat != t.substr(0, i)) break; t = t.substr(i, t.size()-i); if(t == "") return true; } } return false; } };