题解 | #Where in 和Not in#

统计大写字母个数

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

import java.io.*; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str;

    while((str = in.readLine()) != null){
           int total = 0;
        char[] ch = str.toCharArray();
        int len = ch.length;
        for(int i = 0;i < len;i++){
            if(ch[i] <= 'Z' && ch[i] >= 'A'){
                total ++;
            }
        }
        System.out.println(total);
        
    }
}

}

全部评论

相关推荐

影04714:把图书管理系统那个项目经验内容适当的减少掉,然后改成据为己有不要说团队项目,因为图书管理系统这类常见的谁来了都能独立写出来,提问能圆过来即可
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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