描述
给定一篇文章,包含3行文字,每行有80个字符。请编写程序,统计其中的英文大写字母、小写字母、数字、空格以及其他字符的个数。
输入
输入为三行字符串,每行字符串长度不超过 80。
输出
输出五行,分别表示对应的英文大写字母、小写字母、数字、空格以及其他字符的个数。
输入样例 1
The quick browm fox jumps over the lazy dog. 1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz !@#$%^&*()
输出样例 1
27 60 10 10 11
#include <iostream>
#include <string>
using namespace std;
int main()
{string shuru[3];int i,j;for (i = 0; i < 3; i++){getline(cin, shuru[i]);}int English=0, english=0, number=0, blank=0, other=0;for (i = 0; i < 3; i++){for (j = 0; j < shuru[i].size(); j++){if (shuru[i][j] >= 'A' && shuru[i][j] <= 'Z')English++;else if (shuru[i][j] >= 'a' && shuru[i][j] <= 'z')english++;else if (shuru[i][j] >= '0' && shuru[i][j] <= '9')number++;else if (shuru[i][j] == ' ')blank++;else other++;}}cout << English << endl << english << endl << number << endl << blank <<endl<< other;return 0;
}