#include
#include
using namespace std;
const int rangeNum = 5;
const int bufferSize = 256;
char buffer[bufferSize];
int range[rangeNum][2] = {{'A','Z'},{'a','z'},{'0','9'},{' ',' '},{0,256}};
char print[rangeNum][100] = {"大写字母","小写字母","数字","空格","其他"};
int ans[rangeNum];
int main() {
ifstream fin("D:\\作业.txt");
memset(ans,0,sizeof(ans));
while ( fin.getline(buffer,bufferSize) ) {
for (int i = 0; buffer[i] != '\0'; ++i) {
int j;
for (j = 0; j < rangeNum; ++j) {
if (range[j][0] <= buffer[i] && range[j][1] >= buffer[i]) {
break;
}
}
ans[j]++;
}
}
for (int i = 0; i < rangeNum; ++i) {
cout << print[i] << ":" << ans[i] << endl;
}
fin.close();
return 0;
}