CodePudding user response:
Reference:# include
Int main ()
{
Char s [256];
Int I=0, A [26]={0}, A [26]={0};
Gets (s);
While (s [I]) {
If (s [I] & gt;='A' & amp; & S [I] <='Z')
A [[I] - 'A' s] + +;
If (s [I] & gt;='a' & amp; & S [I] <='z')
A [[I] - 'a' s] + +;
i++;
}
for(i=0; i<26. I++)
Printf (" % [c], [c] % % d: % d \ n ", I, 'A' + A [I], 'A' + I, A [I]);
return 0;
}
CodePudding user response:
# include
#include
Int main ()
{
Char STR [128], * PSTR;
Int I=0, upper [26]={0}, the lower [26]={0};
The fgets (STR, sizeof (STR), stdin);
PSTR=STR;
While (* PSTR) {
If (isupper (* PSTR))
Upper [* PSTR - 'A'] + +;
Else if (islower (* PSTR))
The lower [* PSTR - 'a'] + +;
Pstr++;
}
for(i=0; i <26. I++)
Printf (" % [c], [c] % % d: % d \ n ", 'A' + I, upper [I], 'A' + I, lower [I]);
return 0;
}
For your reference ~