题解 | #字母统计#

字母统计

https://www.nowcoder.com/practice/de7bf0945c1c4bd1aa9d49573b831f3c

#include <iostream>
using namespace std;

int cnt[26];

int main() {
    string str;
    while (getline(cin, str)) {
        for(int i = 0; i < str.length(); i ++){
            if(str[i] >= 'A' && str[i] <= 'Z')
                cnt[str[i] - 'A'] ++;
        }
        for(int i = 0; i < 26; i ++)
            printf("%c:%d\n", 'A'+i, cnt[i]);
    }
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

废物一个0offer:认真的吗二本本科找人工智能岗位
点赞 评论 收藏
分享
05-19 19:57
蚌埠学院 Python
2237:Gpa70不算高,建议只写排名,个人技能不在多而在精,缩到8条以内。项目留一个含金量高的,减少间距弄到一页,硕士简历也就一页,本科不要写很多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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