题解 | #统计大写字母个数#

统计大写字母个数

https://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    getline(cin, s);

    int ans = 0;
    for (char c : s) {
        if (c >= 'A' && c <= 'Z')
            ans++;
    }

    cout << ans;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

Twilight_m...:还是不够贴近现实,中关村那块60平房子200万怎么可能拿的下来,交个首付还差不多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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