#include<stdio.h>
int main()
{
char l[999999];
long max_l=0,m=0;
int flag=0,i=0,e=0;
printf("Enter a sentence, and let's see what we can get :)\n");
while((l[i++]=getchar())!='\n');
l[i]='\0';
printf("Eh you know ;) , the longest word is:\n");
for(i=0;l[i]!='\0';i++)
{
if(l[i]>='A'&&l[i]<='Z'||l[i]>='a'&&l[i]<='z')
{
if(!flag)
flag=1;
max_l++;
}
else
{
flag=0;
if(m<max_l)
{
m=max_l;
e=i;
}
max_l=0;
}
}
for(i=e-m;i<e;i++)
printf("%c",l[i]);
printf("\n");
return 0;
}
int main()
{
char l[999999];
long max_l=0,m=0;
int flag=0,i=0,e=0;
printf("Enter a sentence, and let's see what we can get :)\n");
while((l[i++]=getchar())!='\n');
l[i]='\0';
printf("Eh you know ;) , the longest word is:\n");
for(i=0;l[i]!='\0';i++)
{
if(l[i]>='A'&&l[i]<='Z'||l[i]>='a'&&l[i]<='z')
{
if(!flag)
flag=1;
max_l++;
}
else
{
flag=0;
if(m<max_l)
{
m=max_l;
e=i;
}
max_l=0;
}
}
for(i=e-m;i<e;i++)
printf("%c",l[i]);
printf("\n");
return 0;
}