Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[256],v[]="aeiou";
- cin.getline(s,256);
- int lmax=0,pmax;
- for(int i=0;i<strlen(s)-1;++i)
- {
- for(int j=i+1;j<strlen(s);++j)
- if(s[i]==s[j])
- {
- int pi=i;
- int pj=j;
- while(s[pi]==s[pj] and s[pi]!=NULL and s[pj]!=NULL)
- {
- pi++;
- pj++;
- }
- int l=pi-i;
- if(l>lmax)
- {
- lmax=l;
- pmax=i;
- }
- else
- if(l==lmax)
- {
- if(s[pmax]>s[i])
- pmax=i;
- else
- if(s[i]==s[pmax])
- {
- int i1=pmax;
- int i2=i;
- while(s[i1]==s[i2] and s[i1]!=NULL and s[i2]!=NULL)
- {
- i1++;
- i2++;
- if(s[i1]>s[i2])
- pmax=i;
- }
- }
- }
- }
- }
- for(int i=pmax;i<pmax+lmax;++i)
- cout<<s[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement