/* Generated by re2c */
// re2c $INPUT -o $OUTPUT --loop-switch -i
#include <assert.h>

// expect a null-terminated string
static int lex(const char *YYCURSOR)
{
    int count = 0;
loop:
    
{
	char yych;
	unsigned int yystate = 0;
	for (;;) {
		switch (yystate) {
			case 0:
				yych = *YYCURSOR;
				++YYCURSOR;
				switch (yych) {
					case 0x00:
						yystate = 1;
						continue;
					case ' ':
						yystate = 3;
						continue;
					case 'a':
					case 'b':
					case 'c':
					case 'd':
					case 'e':
					case 'f':
					case 'g':
					case 'h':
					case 'i':
					case 'j':
					case 'k':
					case 'l':
					case 'm':
					case 'n':
					case 'o':
					case 'p':
					case 'q':
					case 'r':
					case 's':
					case 't':
					case 'u':
					case 'v':
					case 'w':
					case 'x':
					case 'y':
					case 'z':
						yystate = 5;
						continue;
					default:
						yystate = 2;
						continue;
				}
			case 1: { return count; }
			case 2: { return -1; }
			case 3:
				yych = *YYCURSOR;
				switch (yych) {
					case ' ':
						++YYCURSOR;
						yystate = 3;
						continue;
					default:
						yystate = 4;
						continue;
				}
			case 4: { goto loop; }
			case 5:
				yych = *YYCURSOR;
				switch (yych) {
					case 'a':
					case 'b':
					case 'c':
					case 'd':
					case 'e':
					case 'f':
					case 'g':
					case 'h':
					case 'i':
					case 'j':
					case 'k':
					case 'l':
					case 'm':
					case 'n':
					case 'o':
					case 'p':
					case 'q':
					case 'r':
					case 's':
					case 't':
					case 'u':
					case 'v':
					case 'w':
					case 'x':
					case 'y':
					case 'z':
						++YYCURSOR;
						yystate = 5;
						continue;
					default:
						yystate = 6;
						continue;
				}
			case 6: { ++count; goto loop; }
		}
	}
}

}

int main()
{
    assert(lex("") == 0);
    assert(lex("one two three") == 3);
    assert(lex("f0ur") == -1);
    return 0;
}
