Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.Example 1:Input: "abab"Output: TrueExplanation: It's the substring "ab" twice.Example 2:Input: "aba"Output: FalseExample 3:Input: "abcabcabcabc"Output: TrueExplanation: It's the substring "abc" four times. (And the substring "abcabc" twice.)class Solution {public: bool repeatedSubstringPattern(string s) { const int len = s.length(); for(int i=1; i<=len/2; ++i){ string tmp = s.substr(0, i); int start = i; while(s.substr(start, i) == tmp && start+i <= len) start += i; if(start == len) return true; } return false; }};