#include <stdio.h>
int main(){
size_t i, j, bgn, end;
const char text[] = "This is sample text for find max length";
for( i = j = bgn = end = 0; text[i]; i++ )
{
if
(
text[i] == ' ' || text[i] == '\t' || text[i] == '\n' || text[i] == '\r' /*isspace*/
||
text[i] == '.' || text[i] == ',' || text[i] == '?' || text[i] == '!' /*ispunkt*/
)
{
//зустріли деліметр
if( i - j > end - bgn )
{
bgn = j;
end = i;
}
j = i + 1;
}
}
printf("maxword : \n");
for( i = bgn; i <= end; i++ )
printf("%c", text[i]);
return 0;
}