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

统计大写字母个数

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

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            String str1=sc.nextLine();
            char ch[]=str1.toCharArray();
            int count=0;
            for(char ch1:ch){
                if(ch1>='A'&&ch1<='Z'){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
全部评论

相关推荐

06-15 20:57
已编辑
门头沟学院 Java
CARLJOSEPH...:年轻人有傲气很正常,但是建议工作前洗净傲气。 说实在的,什么奖学金什么奖项的都很一般。尊重你的老师,在有时间的时候去上课,真遇到走不开的事,请态度端正地向你的老师说明情况,请求请假。我相信任何一个有师德的老师都会允许的(我的老师就是这样)。
点赞 评论 收藏
分享
评论
4
收藏
分享

创作者周榜

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