https://i0.wp.com/eblogarithm.com/wp-content/uploads/2016/10/Codeforces-Round-378-Div-2-Problem-A-Grasshopper-And-the-String-Solution-in-C.png?fit=640%2C360

Codeforces Round #378 (Div. 2), Problem: (A) Grasshopper And the String Solution in C

Hi guys , i just tried the Grasshopper problem , hope you might like it .

#include
int main(){
char a[101];int k=-1,i,max=0,s;
scanf(“%s”,a);
for(i=0;a[i]!=’\0′;i++)
{ if(a[i]==’A’||a[i]==’E’||a[i]==’I’||a[i]==’O’||a[i]==’U’||a[i]==’Y’)
{s=i-k;k=i;
if(s>max)
max=s;}

}s=i-k;
if(s>max)
max=s;
printf(“%d”,max);
return 0;
}

(Visited 169 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: