Write A Program To Count Uppercase And Lowercase Letters In File

 


Input Text File

Increase Input Text File

Code


%{

#include<stdio.h>
int U=0;
int L=0;
%}

%%
[A-Z] U++;
[a-z] L++;

%%

main()
{
extern FILE *yyin;
yyin=fopen("UpperLowerInput.txt","r");
if(yyin==NULL){
printf("File Not Found");
}
yylex();

printf("\nTotal No of UpperCase Character=%d",U);
printf("\nTotal No of LowerCase Character=%d",L);
}
int yywrap()
{
return 1;
}


Output






Comments