%{
#include <stdio.h>
#include <ctype.h>
int line_count = 0;
int word_count = 0;
int letter_count = 0;
int special_count = 0;
%}
%%
\n { line_count++; }
[[:alpha:]]+ { word_count++; letter_count += yyleng; }
[^a-zA-Z0-9\n\t\s] { special_count++; }
%%
int main() {
yylex(); // Start scanning input
printf("Lines: %d\n", line_count);
printf("Words: %d\n", word_count);
printf("Letters: %d\n", letter_count);
printf("Special characters: %d\n", special_count);
return 0;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxjdHlwZS5oPgoKaW50IGxpbmVfY291bnQgPSAwOwppbnQgd29yZF9jb3VudCA9IDA7CmludCBsZXR0ZXJfY291bnQgPSAwOwppbnQgc3BlY2lhbF9jb3VudCA9IDA7CiV9CgolJQoKXG4gICAgICAgICAgICAgICAgICAgICAgeyBsaW5lX2NvdW50Kys7IH0KW1s6YWxwaGE6XV0rICAgICAgICAgICAgeyB3b3JkX2NvdW50Kys7IGxldHRlcl9jb3VudCArPSB5eWxlbmc7IH0KW15hLXpBLVowLTlcblx0XHNdICAgICAgeyBzcGVjaWFsX2NvdW50Kys7IH0KCiUlCgppbnQgbWFpbigpIHsKICAgIHl5bGV4KCk7ICAvLyBTdGFydCBzY2FubmluZyBpbnB1dAogICAgcHJpbnRmKCJMaW5lczogJWRcbiIsIGxpbmVfY291bnQpOwogICAgcHJpbnRmKCJXb3JkczogJWRcbiIsIHdvcmRfY291bnQpOwogICAgcHJpbnRmKCJMZXR0ZXJzOiAlZFxuIiwgbGV0dGVyX2NvdW50KTsKICAgIHByaW50ZigiU3BlY2lhbCBjaGFyYWN0ZXJzOiAlZFxuIiwgc3BlY2lhbF9jb3VudCk7CiAgICByZXR1cm4gMDsKfQo=