%{
#include <stdio.h>
#include <stdlib.h>
int sum = 0;  // Variable to store the sum
%}

%%
[0-9]+      { sum += atoi(yytext); }  // Convert text to int and add to sum
\n          { printf("Sum: %d\n", sum); sum = 0; }  // Print sum after each line
[ \t]        { /* Ignore spaces and tabs */ }
.            { /* Ignore any other characters */ }
%%

int main() {
    printf("Enter two numbers separated by spaces or newlines to sum them:\n");
    yylex();  // Start lexical analysis
    return 0;
}
