题解 | #字符统计#

字符统计

https://ac.nowcoder.com/acm/problem/22202

#include <bits/stdc++.h>

using namespace std;

int main()
{
    char c;
    c = getchar();
    int Letters = 0,Digits = 0,Others = 0;
    while(c != '?')
    {
        if((c >= 'a' && c <= 'z')||(c >= 'A' && c <= 'Z')) Letters++;
        else if(c >= '0' && c <= '9') Digits++;
        else Others++;
        c = getchar();
    }
    printf("Letters=%d\n",Letters);
    printf("Digits=%d\n",Digits);
    printf("Others=%d",Others);
    return 0;
}
全部评论

相关推荐

评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务