- الكود:
#include <iostream>
using namespace std;
int main()
{
int y=0,n=101,x=0,z=0,s=0,t=0,r=0,o=0;
char number[n];
for( int i = 0; i <n; i++ ) //ABABBBACFEYUKOTT
{cin.get(number[i]);
x++;
if(number[i] == '\n' || number[i] == ' ')
break;
if ((((number[i]=='A')||(number[i]=='E')||(number[i]=='I')||(number[i]=='O')||(number[i]=='U')||(number[i]=='Y'))&&(i==0)))
{
r=0;
s++;
z=1;
t++;
o=i;}
if ((((number[i]=='A')||(number[i]=='E')||(number[i]=='I')||(number[i]=='O')||(number[i]=='U')||(number[i]=='Y'))&&(y==0)))
{
r=i;
o=i;
s++;
if(z==0)
z=1+i;
else if ((i-r)>z)
z==i-r;
y++;}
else if (((number[i]=='A')||(number[i]=='E')||(number[i]=='I')||(number[i]=='O')||(number[i]=='U')||(number[i]=='Y')))
{
o=i;
if (s==0){ z=y;}
else if((i>z)&&((i-r)>z)){ z=(i-r);}
else if((i<z)&&((r-i)>z)){ z=(r-i);}
else if (((y<z)||(y==z))&&(s!=0)){ t++;}
y=1;
s++;
r=i;
}
}
if (z==0)
cout<<x;
else if ((number[x-1]!='A'||'E'||'I'||'O'||'U'||'Y')&&(x-o>z))
cout<<x-(1+o);
else
cout<<z;
return 0;
}
مواضيع مماثلة
W - Grasshopper And the String #3
Admin- Admin
- عدد المساهمات : 413
تاريخ التسجيل : 20/10/2010
- مساهمة رقم 1