Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- const int ext=500006;
- string word;
- int res, ps[ext];
- bool found;
- bool pattern(int k){
- for(int i=0; i<word.size(); i++)
- if(word[i]!=word[i%k])
- return 0;
- return 1;
- }
- int main(){
- cin>>word;
- /* for(int i=1; i<word.length(); i++){
- found=0;
- for(int j=ps[i-1]; !found; j=ps[j]){
- if(word[j+1]==word[i]){
- found=1;
- ps[i]=j+1;
- }
- else if(j==0){
- found=1;
- ps[i]=0;
- if(word[0]==word[i])
- ps[i]=1;
- }
- }
- */ }
- res=word.length();
- /* for(int i=ps[word.length()-1]; i>0; i=ps[i])
- if(pattern(i))
- res=i;
- cout<<res;
- */ return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement