#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#define MAXLEN 100
int main(void)
{
	char pp[MAXLEN+1];
	if(fgets(pp,MAXLEN+1,stdin) == NULL ){
	    fprintf(stderr,"Error in input");
	    exit(EXIT_FAILURE);
	}
	char *ptr = pp;
	char *end;
	long i = strtol(ptr, &end, 10);
	while( ptr != end )
	{
	    ptr = end;
	    if (errno == ERANGE){
	        printf("range error, got ");
	        errno = 0;
	    }
	    printf("Got - %ld\n", i);
	    /* work with i */
	    i = strtol(ptr, &end, 10);
	}
	return 0;
}