#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <libp.h>

char *__strtoone(char **buffer, const char *format, void *arg, int *count,int *chars) ;
static int _scanf(const char *format,void *arglist)
{
	int i = 0,j=0;
	char p[512],*buffer = p ;
	buffer[0] = 0 ;
	while (format && *format) {
		if (!*buffer) {
			fgets(p,512,stdin);
			buffer = p;
		}
		while (*format != '%' && *format && *buffer) {
			if (isspace(*format)) {
				if (!isspace(*buffer))
					return i;
				while (isspace(*++buffer) && *buffer);
				while (isspace(*++format) && *format);
			}
			else  {
				if (*format++ != *buffer++)
					return i;
			}
		}
		if (*format && *buffer) {
			format++;
			format = __strtoone(&buffer,format,((char **)arglist)[i],&i,&j);
		}
	}
	return(i);
}
int scanf(const char *format, ...)
{
	return _scanf(format,((char *)&format+sizeof(char *)));
}