// Generated by re2java
// re2java $INPUT -o $OUTPUT



class Main {
    static int lex_simple(byte[] yyinput) {
        int yycursor = 0;
        int yymarker = 0;
        int yylimit = yyinput.length - 1;

        
{
    int yych = 0;
    int yystate = 0;
    yyl: while (true) {
        switch (yystate) {
            case 0:
                if (yylimit <= yycursor) {
                    yystate = 8;
                    continue yyl;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                yycursor += 1;
                switch (yych) {
                    case 0x61:
                        yystate = 3;
                        continue yyl;
                    case 0x62:
                        yystate = 4;
                        continue yyl;
                    case 0x63:
                        yystate = 5;
                        continue yyl;
                    default:
                        yystate = 1;
                        continue yyl;
                }
            case 1:
                yystate = 2;
                continue yyl;
            case 2:
                { return 1; }
            case 3:
                if (yylimit <= yycursor) {
                    yystate = 9;
                    continue yyl;
                }
                { return 3; }
            case 4:
                { return 4; }
            case 5:
                yymarker = yycursor;
                if (yylimit <= yycursor) {
                    yystate = 10;
                    continue yyl;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        yystate = 2;
                        continue yyl;
                }
            case 6:
                if (yylimit <= yycursor) {
                    yystate = 10;
                    continue yyl;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        yystate = 7;
                        continue yyl;
                }
            case 7:
                yycursor = yymarker;
                yystate = 2;
                continue yyl;
            case 8:
                { return 0; }
            case 9:
                { return 2; }
            case 10:
                { return 5; }
            default:
                throw new IllegalStateException("internal lexer error");
        }
    }
}

    }

    static int lex_eof(byte[] yyinput) {
        int yycursor = 0;
        int yymarker = 0;
        int yylimit = yyinput.length - 1;

        
{
    int yych = 0;
    int yystate = 0;
    yyl: while (true) {
        switch (yystate) {
            case 0:
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x61:
                        yycursor += 1;
                        yystate = 3;
                        continue yyl;
                    case 0x62:
                        yycursor += 1;
                        yystate = 4;
                        continue yyl;
                    case 0x63:
                        yycursor += 1;
                        yystate = 5;
                        continue yyl;
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 0;
                                continue yyl;
                            }
                            yystate = 8;
                            continue yyl;
                        }
                        yycursor += 1;
                        yystate = 1;
                        continue yyl;
                }
            case 1:
                yystate = 2;
                continue yyl;
            case 2:
                { return 1; }
            case 3:
                if (yycursor == yylimit) {
                    yystate = 9;
                    continue yyl;
                }
                { return 3; }
            case 4:
                { return 4; }
            case 5:
                yymarker = yycursor;
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 5;
                                continue yyl;
                            }
                            yystate = 10;
                            continue yyl;
                        }
                        yystate = 2;
                        continue yyl;
                }
            case 6:
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        if (yylimit <= yycursor) {
                            if (false) {
                                yystate = 6;
                                continue yyl;
                            }
                            yystate = 10;
                            continue yyl;
                        }
                        yystate = 7;
                        continue yyl;
                }
            case 7:
                yycursor = yymarker;
                yystate = 2;
                continue yyl;
            case 8:
                { return 0; }
            case 9:
                { return 2; }
            case 10:
                { return 5; }
            default:
                throw new IllegalStateException("internal lexer error");
        }
    }
}

    }

    static final int YYMAXFILL = 2;


    static int lex_scc(byte[] str) {
        int yycursor = 0;
        int yymarker = 0;
        int len = str.length - 1; // skip terminating null
        int yylimit = len + YYMAXFILL;

        byte[] yyinput = new byte[yylimit];
        System.arraycopy(str, 0, yyinput, 0, len);

        
{
    int yych = 0;
    int yystate = 0;
    yyl: while (true) {
        switch (yystate) {
            case 0:
                if (yycursor == len) {
                    yystate = 8;
                    continue yyl;
                }
                if ((yylimit - yycursor) < 2) {
                    return -1;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                yycursor += 1;
                switch (yych) {
                    case 0x61:
                        yystate = 3;
                        continue yyl;
                    case 0x62:
                        yystate = 4;
                        continue yyl;
                    case 0x63:
                        yystate = 5;
                        continue yyl;
                    default:
                        yystate = 1;
                        continue yyl;
                }
            case 1:
                yystate = 2;
                continue yyl;
            case 2:
                { return 1; }
            case 3:
                if (yycursor == len) {
                    yystate = 9;
                    continue yyl;
                }
                { return 3; }
            case 4:
                { return 4; }
            case 5:
                yymarker = yycursor;
                if (yycursor == len) {
                    yystate = 10;
                    continue yyl;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        yystate = 2;
                        continue yyl;
                }
            case 6:
                if (yycursor == len) {
                    yystate = 10;
                    continue yyl;
                }
                if (yylimit <= yycursor) {
                    return -1;
                }
                yych = Byte.toUnsignedInt(yyinput[yycursor]);
                switch (yych) {
                    case 0x63:
                        yycursor += 1;
                        yystate = 6;
                        continue yyl;
                    default:
                        yystate = 7;
                        continue yyl;
                }
            case 7:
                yycursor = yymarker;
                yystate = 2;
                continue yyl;
            case 8:
                { return 0; }
            case 9:
                { return 2; }
            case 10:
                { return 5; }
            default:
                throw new IllegalStateException("internal lexer error");
        }
    }
}

    }

    static void test(byte[] str, int retval) {
        assert lex_simple(str) == retval;
        assert lex_eof(str) == retval;
        assert lex_scc(str) == retval;
    }

    public static void main(String []args) {
        test("\0".getBytes(), 0);
        test("a\0".getBytes(), 2);
        test("ax\0".getBytes(), 3);
        test("b\0".getBytes(), 4);
        test("bx\0".getBytes(), 4);
        test("ccc\0".getBytes(), 5);
    }
};
