import java.util.Scanner; public class bigLetterCount { public static int CalcCapital(String str){ int count=0; for(int i=0;i<str.length();i++){ if('A'<=str.charAt(i)&&str.charAt(i)<='Z')count++; } return count; } public static void main(String args[]){ Scanner input=new Scanner(System.in); String s=input.nextLine(); System.out.println(CalcCapital(s)); } }
原文地址:http://blog.csdn.net/whu_sky/article/details/38042451