%{
#include <stdio.h>
#include <string.h>

char targetWord[] = "jai";
int wordPosition = 0;        
%}

%%

[a-zA-Z]+ {
    if (strcmp(yytext, targetWord) == 0) {
        printf("Found '%s' at position %d.\n", yytext, wordPosition);
    }
    wordPosition++;
}

[ \t\n]+ ;

. {
   
}

%%

int main() {
    printf("Enter a sentence: ");
    yylex();
    return 0;
}


int yywrap()
{
    return 1;  
}