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;
}

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;
}

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertismentspot_img

Latest posts

Curiosity has found the largest field of honeycomb fractures it has ever encountered on Mars. Similar polygons elsewhere preserve mud repeatedly soaked and dried...

NASA’s Curiosity rover has made an extraordinary geological discovery on the Red Planet, uncovering the largest expanse of honeycomb-shaped fractures it has ever encountered....

7 Reasons This Viral Kitchen Gadgets Is Worth Every Single Penny

📢 As an Amazon Associate, I earn from qualifying purchases.I stumbled across this while desperately trying to fix a recurring problem in my routine....

Stop Buying Cheap Alternatives This Viral Kitchen Gadgets Is the Real Deal

📢 As an Amazon Associate, I earn from qualifying purchases.I stumbled across this while desperately trying to fix a recurring problem in my routine....

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!